diff options
author | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2010-06-30 17:06:25 +0400 |
---|---|---|
committer | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2010-06-30 17:06:25 +0400 |
commit | 1c5388765fc121ca8e5458df80c955bc209841db (patch) | |
tree | 5e749a0b8450febd1a459271dd9f3037725e613a /mysql-test/r | |
parent | 18388d2105efe47f59e7a201154907ec9d7508df (diff) | |
download | mariadb-git-1c5388765fc121ca8e5458df80c955bc209841db.tar.gz |
Bug#51431 Wrong sort order after import of dump file
The problem is that QUICK_SELECT_DESC behaviour depends
on used_key_parts value which can be bigger than selected
best_key_parts value if an engine supports clustered key.
But used_key_parts is overwritten with best_key_parts
value that prevents from correct selection of index
access method. The fix is to preserve used_key_parts
value for further use in QUICK_SELECT_DESC.
mysql-test/r/innodb_mysql.result:
test case
mysql-test/t/innodb_mysql.test:
test case
sql/sql_select.cc:
preserve used_key_parts value for further use in QUICK_SELECT_DESC
Diffstat (limited to 'mysql-test/r')
-rw-r--r-- | mysql-test/r/innodb_mysql.result | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 2af3db75adc..e2f28b96f7e 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -2455,4 +2455,36 @@ AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge PRIMARY,idx1,idx2 idx2,idx1,PRIMARY 7,60,4 NULL 1 Using intersect(idx2,idx1,PRIMARY); Using where DROP TABLE t1; +# +# Bug#51431 Wrong sort order after import of dump file +# +CREATE TABLE t1 ( +f1 INT(11) NOT NULL, +f2 int(11) NOT NULL, +f3 int(11) NOT NULL, +f4 tinyint(1) NOT NULL, +PRIMARY KEY (f1), +UNIQUE KEY (f2, f3), +KEY (f4) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1), +(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1), +(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1), +(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1), +(26,1,9921,1), (27,1,9922,1); +FLUSH TABLES; +SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; +f1 f2 f3 f4 +27 1 9922 1 +26 1 9921 1 +25 1 9920 1 +24 1 9919 1 +23 1 9918 1 +EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE +ORDER BY f1 DESC LIMIT 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where +DROP TABLE t1; End of 5.1 tests |