[MDEV-2998] LP:802858 - Inferior plan selected after mwl#106 with ORDER BY Created: 2011-06-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 | ||
| Reporter: | Philip Stoev (Inactive) | Assignee: | Igor Babaev |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following view: CREATE VIEW v1 AS SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9 ; is executed with an inferior plan after mwl#106 . Before mwl106: explain: 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9 counters: Handler_read_next 0 after mwl106: explain: 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 222 counters: -Handler_read_next 208 The results returned are also different, but I do not know if the difference is legitimate or not. Test case: CREATE TABLE t1 ( INSERT INTO t1 VALUES (1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5), (6, 6, 6), (7, 7, 7), (8, 8, 8), (9, 9, 9); INSERT INTO t1 SELECT a + 10, b, c FROM t1; CREATE VIEW v1 AS SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9 ; |
| Comments |
| Comment by Philip Stoev (Inactive) [ 2011-06-28 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Inferior plan selected after mwl#106 with ORDER BY --source include/have_udf.inc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2011-07-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Inferior plan selected after mwl#106 with ORDER BY I've got similar results without views: MariaDB [test]> FLUSH STATUS; MariaDB [test]> SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9 ;
------
------ MariaDB [test]> SHOW STATUS LIKE '%Handler%';
---------------------------
--------------------------- MariaDB [test]> EXPLAIN SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9 ;
---
--- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2011-07-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Inferior plan selected after mwl#106 with ORDER BY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2011-07-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: Inferior plan selected after mwl#106 with ORDER BY The plan and the performance for the query SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9 ; is identical for both revisions. However the plan and the performance for SELECT * FROM v1; are different across revisions. In addition, I think it is important to figure out why the UDF in the other example gets called twice per row. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rasmus Johansson (Inactive) [ 2011-08-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Launchpad bug id: 802858 |