diff options
author | Igor Babaev <igor@askmonty.org> | 2012-01-18 03:31:20 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-01-18 03:31:20 -0800 |
commit | 746dbbe583f8528b34065b0669136842128e27b2 (patch) | |
tree | 7f368922928ea854c3c5d6531cc2d757bd63f570 /sql/sql_derived.cc | |
parent | 296b450d3b58ded0fd4d4972161414c6cc7a80e5 (diff) | |
download | mariadb-git-746dbbe583f8528b34065b0669136842128e27b2.tar.gz |
Fixed LP bug #917990.
If the expression for a derived table of a query contained a LIMIT
clause the estimate of the number of rows in this derived table
returned by the EXPLAIN command could be badly off since the
optimizer ignored the limit number from the LIMIT clause when
getting the estimate.
The call of the method SELECT_LEX_UNIT->set_limit added in the code
of mysql_derived_optimize() will be needed also in maria-5.5 where
parameters in the LIMIT clause are supported.
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 0e104520fac..0955f9c0982 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -753,6 +753,7 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived) if (!derived->is_merged_derived()) { JOIN *join= first_select->join; + unit->set_limit(first_select); unit->optimized= TRUE; if ((res= join->optimize())) goto err; |