summaryrefslogtreecommitdiff
path: root/sql/sql_select.h
diff options
context:
space:
mode:
authorOleg Smirnov <olernov@gmail.com>2023-02-17 19:21:30 +0700
committerOleg Smirnov <olernov@gmail.com>2023-03-20 10:56:41 +0700
commit22ebce8d684cbcbd7ff8c044f387b9cd5ca295f7 (patch)
tree39c73cedf0ee173d437da42c84d0090420e9554c /sql/sql_select.h
parentce4a289f1c367987977f1a02bbb8d8b8e8e6bb53 (diff)
downloadmariadb-git-bb-11.0-MDEV-8320.tar.gz
MDEV-8320 Allow index usage for DATE(col) <=> const and YEAR <=> constbb-11.0-MDEV-8320
Rewrite datetime comparison conditions into sargeable. For example, YEAR(col) <= val -> col <= YEAR_END(val) YEAR(col) < val -> col < YEAR_START(val) YEAR(col) >= val -> col >= YEAR_START(val) YEAR(col) > val -> col > YEAR_END(val) YEAR(col) = val -> col BETWEEN YEAR_START(val) AND YEAR_END(val) Do the same with DATE(col), for example: DATE(col) <= val -> col <= DAY_END(val) After such a rewrite index lookup on column "col" can be employed
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r--sql/sql_select.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h
index fa4d373d556..5a750823828 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -1814,6 +1814,7 @@ private:
void free_pushdown_handlers(List<TABLE_LIST>& join_list);
void init_join_cache_and_keyread();
bool transform_in_predicates_into_equalities(THD *thd);
+ bool transform_date_conds_into_sargable();
bool transform_all_conds_and_on_exprs(THD *thd,
Item_transformer transformer);
bool transform_all_conds_and_on_exprs_in_join_list(THD *thd,