diff options
author | unknown <gshchepa/uchum@host.loc> | 2008-04-26 02:45:58 +0500 |
---|---|---|
committer | unknown <gshchepa/uchum@host.loc> | 2008-04-26 02:45:58 +0500 |
commit | 5b8cdbf4a652e3a39aa2bd894c43293fb007a694 (patch) | |
tree | 168fdf05aa71e4176ac8753ebb98afdbd5b05dca /mysql-test/t/merge.test | |
parent | 304c4381e69647aac38c7304bc0c3e4592f487dd (diff) | |
download | mariadb-git-5b8cdbf4a652e3a39aa2bd894c43293fb007a694.tar.gz |
Fixed bug#36006: Optimizer does table scan for SELECT COUNT(*)
for ENGINE=MRG_MYISAM (should be optimized out).
Before WL#3281 MERGE engine had the HA_NOT_EXACT_COUNT flag
unset, and it worked with COUNT optimization as desired.
After the removal of the HA_NOT_EXACT_COUNT flag neither
HA_STATS_RECORDS_IS_EXACT (opposite to former HA_NOT_EXACT_COUNT
flag) nor modern HA_HAS_RECORDS flag were not added to MERGE
table flag mask.
1. The HA_HAS_RECORDS table flag has been set.
2. The ha_myisammrg::records method has been overridden to
calculate total number of records in underlying tables.
storage/myisammrg/myrg_records.c:
Fixed bug#36006: Optimizer does table scan for select count(*).
The myrg_records function has been added to calculate total number
of records in underlying tables.
include/myisammrg.h:
Fixed bug#36006: Optimizer does table scan for select count(*).
The myrg_records function declaration has been added.
mysql-test/r/merge.result:
Added test case for bug#36006.
mysql-test/t/merge.test:
Added test case for bug#36006.
storage/myisammrg/CMakeLists.txt:
Fixed bug#36006: Optimizer does table scan for select count(*).
New myrg_records.c file has been added.
storage/myisammrg/Makefile.am:
Fixed bug#36006: Optimizer does table scan for select count(*).
New myrg_records.c file has been added.
storage/myisammrg/ha_myisammrg.cc:
Fixed bug#36006: Optimizer does table scan for select count(*).
The ha_myisammrg::records method has been overridden.
storage/myisammrg/ha_myisammrg.h:
Fixed bug#36006: Optimizer does table scan for select count(*).
1. The HA_HAS_RECORDS table flag has been set.
2. The ha_myisammrg::records method has been overridden.
Diffstat (limited to 'mysql-test/t/merge.test')
-rw-r--r-- | mysql-test/t/merge.test | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index a4602a3b82a..76e746db037 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -1394,3 +1394,19 @@ FLUSH TABLES m1, t1; UNLOCK TABLES; DROP TABLE t1, m1; +# +# Bug#36006 - Optimizer does table scan for select count(*) +# +CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM; +CREATE TABLE t2(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM; +CREATE TABLE t3(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM; +CREATE TABLE t4(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) + ENGINE=MRG_MYISAM UNION=(t1, t2, t3); +INSERT INTO t1 VALUES (1,1), (1,2),(1,3), (1,4); +INSERT INTO t2 VALUES (2,1), (2,2),(2,3), (2,4); +INSERT INTO t3 VALUES (3,1), (3,2),(3,3), (3,4); +EXPLAIN SELECT COUNT(*) FROM t1; +EXPLAIN SELECT COUNT(*) FROM t4; +DROP TABLE t1, t2, t3, t4; + +--echo End of 5.1 tests |