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 /mysql-test/t/derived_view.test | |
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 'mysql-test/t/derived_view.test')
-rw-r--r-- | mysql-test/t/derived_view.test | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index b674350af0a..f8ba1f347f3 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -1277,6 +1277,20 @@ ORDER BY CONCAT(alias2.col_varchar_nokey); set max_heap_table_size= @tmp_882994; drop table t1,t2,t3; +--echo # +--echo # LP bug #917990: Bad estimate of #rows for derived table with LIMIT +--echo # + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES + (8), (3), (4), (7), (9), (5), (1), (2); + +SELECT * FROM (SELECT * FROM t1 LIMIT 3) t; +EXPLAIN +SELECT * FROM (SELECT * FROM t1 LIMIT 3) t; + +DROP TABLE t1; + # The following command must be the last one the file set optimizer_switch=@exit_optimizer_switch; set join_cache_level=@exit_join_cache_level; |