[MDEV-3462] LP:817363 - Wrong result with range access and multi-part key Created: 2011-07-28 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Philip Stoev (Inactive) | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
Not repeatable with maria-5.2,mysql-5.5 . The following query: SELECT c returns 1 row when executed with sort_union(d,PRIMARY) and 2 rows if executed with other plans or other server versions. EXPLAIN:
optimizer_switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on revision-id: <email address hidden> test case: CREATE TABLE t1 ( a int NOT NULL , b int, c int, d varchar(32), KEY (d,b), PRIMARY KEY (a)) ; SELECT c |
| Comments |
| Comment by Sergei Petrunia [ 2011-08-02 ] | ||||||||||||||||||||||
|
Re: Wrong result with sort_union and multipart key in maria-5.3
--
-- MariaDB [j1]> SELECT * FROM t1 AS alias1 ignore index(d) WHERE alias1.d = 'q' OR alias1.d >= 'q' OR (d IN ( 'j' , 's' , 'i' ) AND ( alias1.b = 102 ));
---
--- | ||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-02 ] | ||||||||||||||||||||||
|
Re: Wrong result with sort_union and multipart key in maria-5.3 | ||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-02 ] | ||||||||||||||||||||||
|
Re: Wrong result with sort_union and multipart key in maria-5.3 debug trace shows that range access scans the following ranges: quick range select, key d, length: 40 and they don't include the d='q', b='1', a='14' row that we're missing. | ||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-02 ] | ||||||||||||||||||||||
|
Re: Wrong result with sort_union and multipart key in maria-5.3 | ||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-02 ] | ||||||||||||||||||||||
|
Re: Wrong result with sort_union and multipart key in maria-5.3 | ||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-02 ] | ||||||||||||||||||||||
|
Re: Wrong result with sort_union and multipart key in maria-5.3 MySQL [j1]> SELECT * FROM t1 AS alias1 ignore index(d) WHERE alias1.d = 'q' OR alias1.d >= 'q' OR (d IN ( 'j' , 's' , 'i' ) AND ( alias1.b = 102 ));
---
--- MySQL [j1]> SELECT * FROM t1 AS alias1 force index(d) WHERE alias1.d = 'q' OR alias1.d >= 'q' OR (d IN ( 'j' , 's' , 'i' ) AND ( alias1.b = 102 ));
--
-- MySQL [j1]> select version();
------------------
------------------ | ||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-03 ] | ||||||||||||||||||||||
|
Re: Wrong result with sort_union and multipart key in maria-5.3 revno: 2876.47.174 | ||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-03 ] | ||||||||||||||||||||||
|
Re: Wrong result with sort_union and multipart key in maria-5.3 revno: 3363.3.16 Preparation patch (does not include fix for the bug):
| ||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-05 ] | ||||||||||||||||||||||
|
Re: Wrong result with sort_union and multipart key in maria-5.3 | ||||||||||||||||||||||
| Comment by Rasmus Johansson (Inactive) [ 2011-12-13 ] | ||||||||||||||||||||||
|
Launchpad bug id: 817363 |