diff options
author | Sergey Vojtovich <svoj@mysql.com> | 2009-02-05 17:03:47 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mysql.com> | 2009-02-05 17:03:47 +0400 |
commit | 071cfc03b7fb706b9262b58a794c6a8871592c3e (patch) | |
tree | 81da4e17ea29c46dd3810eafc956418a5c090208 /mysql-test/r/merge.result | |
parent | b9d02d4669ad45444f5082979e37908125eea3de (diff) | |
download | mariadb-git-071cfc03b7fb706b9262b58a794c6a8871592c3e.tar.gz |
BUG#39185 - Cardinality for merge tables calculated incorrectly.
Every subsequent query to a merge table with indexes was lowering
down cardinality.
The problem was that key statistics was not cleared when merge
children were detached. Causing next attach children perform
incremental key statistics calculation.
Fixed by clearing key statistics when attaching first child.
mysql-test/r/merge.result:
A test case for BUG#39185.
mysql-test/t/merge.test:
A test case for BUG#39185.
storage/myisammrg/myrg_open.c:
Clear key statistics when we're attaching first child, even
if it's buffer was allocated before. This is needed because
detach_children() doesn't clear statistics, causing incremental
statistics calculation.
Diffstat (limited to 'mysql-test/r/merge.result')
-rw-r--r-- | mysql-test/r/merge.result | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 9ab982a6688..b3d73f1225f 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -2041,4 +2041,23 @@ EXPLAIN SELECT COUNT(*) FROM t4; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away DROP TABLE t1, t2, t3, t4; +CREATE TABLE t1(a INT, KEY(a)); +INSERT INTO t1 VALUES(0),(1),(2),(3),(4); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CREATE TABLE m1(a INT, KEY(a)) ENGINE=MERGE UNION=(t1); +SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1'; +CARDINALITY +5 +SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1'; +CARDINALITY +5 +SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1'; +CARDINALITY +5 +SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1'; +CARDINALITY +5 +DROP TABLE t1, m1; End of 5.1 tests |