[MDEV-31510] Allow exists2in and decorrelate-in to work for IN/EXISTS subqueries in arbitrary context Created: 2023-06-21  Updated: 2023-06-21

Status: Open
Project: MariaDB Server
Component/s: Optimizer
Fix Version/s: None

Type: Task Priority: Major
Reporter: Yuchen Pei Assignee: Yuchen Pei
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Blocks
is blocked by MDEV-22534 Trivial correlation detection/removal... In Review

 Description   

Currently these transformations only apply if the subquery is either toplevel (e.g. select ... from ... where ... in (...);, or a toplevel not (e.g. select ... from ... where not exists (...);). It may be useful to enable them for subqueries in any context (e.g. select ... from ... where (... in (...)) is null).

Before starting, it would be good to have an example query where such enhancement helps (e.g. allows materialization).

An idea of implementing this is to use transformers instead of processors, the latter used in the current implementation as exists2in_processor().

Examples of transformers:

  virtual Item *neg_transformer(THD *thd) { return NULL; }
  virtual Item *update_value_transformer(THD *thd, uchar *select_arg)
  { return this; }
  virtual Item *expr_cache_insert_transformer(THD *thd, uchar *unused)
  { return this; }
  virtual Item *derived_field_transformer_for_having(THD *thd, uchar *arg)
  { return this; }


Generated at Thu Feb 08 10:24:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.