diff options
author | unknown <mhansson/martin@linux-st28.site> | 2007-09-28 09:36:05 +0200 |
---|---|---|
committer | unknown <mhansson/martin@linux-st28.site> | 2007-09-28 09:36:05 +0200 |
commit | 5a17730824735f79b8c12b1151535f3972b510d3 (patch) | |
tree | 460aff71f6521768103aa1b91ebd02610ec1f01e /mysql-test/r/group_by.result | |
parent | bd8e7fee1f260b6f5b9b39c67bb6e701eace3cae (diff) | |
download | mariadb-git-5a17730824735f79b8c12b1151535f3972b510d3.tar.gz |
Bug#30665: Inconsistent optimization of IGNORE INDEX FOR {ORDER BY|GROUP BY}
The optimizer takes different execution paths during EXPLAIN than SELECT,
this fix relates only to EXPLAIN, hence no behavior changes.
The test of sort keys for ORDER BY was prohibited from considering keys
that were mentioned in IGNORE KEYS FOR ORDER BY. This led to two
inconsistencies: One was that IGNORE INDEX FOR GROUP BY and
IGNORE INDEX FOR ORDER BY gave apparently different EXPLAINs; the latter
erroneously claimed to do filesort. The second inconsistency
is that the test of sort keys is called twice, finding a sort key the first
time but not the second time, leading to the mentioned filesort.
Fixed by making the test of sort keys consider all enabled
keys on the table. This test rejects keys that are not covering, and for
covering keys the hint should be ignored anyway.
mysql-test/r/group_by.result:
Bug#30665: Changed test result. The plan gets more efficient here.
The output is included in order to show that it is still correct.
mysql-test/r/order_by.result:
Bug#30665: Test result
mysql-test/t/group_by.test:
Bug#30665: Changed test case to show correctness of changed plan
mysql-test/t/order_by.test:
Bug#30665: Test case
sql/sql_select.cc:
Bug#30665:
- the fix: Give test_if_skip_sort_order all keys not the subset of non-disabled keys.
- Added comment to test_if_skip_sort_order
Diffstat (limited to 'mysql-test/r/group_by.result')
-rw-r--r-- | mysql-test/r/group_by.result | 148 |
1 files changed, 147 insertions, 1 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 2faf7832aca..0b38cc2290e 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1096,7 +1096,153 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort +1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index +SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a; +a +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) IGNORE INDEX FOR GROUP BY (i2) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra |