diff options
author | gshchepa/uchum@gleb.loc <> | 2007-07-19 18:39:01 +0500 |
---|---|---|
committer | gshchepa/uchum@gleb.loc <> | 2007-07-19 18:39:01 +0500 |
commit | 73b2848f4f3647a4b91740af5fb195423593ca9c (patch) | |
tree | ea2a8315a5b624a4976fad41833c8898a032cbd9 /sql | |
parent | 92b65b8a4ba88dc7477130e470dddb73d37e3c3d (diff) | |
download | mariadb-git-73b2848f4f3647a4b91740af5fb195423593ca9c.tar.gz |
Fixed bug #29338.
Optimization of queries with DETERMINISTIC functions in the
WHERE clause was not effective: sequential scan was always
used.
Now a SF with the DETERMINISTIC flags is treated as constant
when it's arguments are constants (or a SF doesn't has arguments).
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_func.cc | 10 | ||||
-rw-r--r-- | sql/item_func.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index b256ce4624a..e05f0a45083 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -5591,5 +5591,15 @@ Item_func_sp::fix_fields(THD *thd, Item **ref) #endif /* ! NO_EMBEDDED_ACCESS_CHECKS */ } + if (!m_sp->m_chistics->detistic) + used_tables_cache |= RAND_TABLE_BIT; DBUG_RETURN(res); } + + +void Item_func_sp::update_used_tables() +{ + Item_func::update_used_tables(); + if (!m_sp->m_chistics->detistic) + used_tables_cache |= RAND_TABLE_BIT; +} diff --git a/sql/item_func.h b/sql/item_func.h index 9a0201cb28b..56b5e75652c 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1467,7 +1467,7 @@ public: virtual ~Item_func_sp() {} - table_map used_tables() const { return RAND_TABLE_BIT; } + void update_used_tables(); void cleanup(); |