[MDEV-771] LP:806894 - SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup Created: 2011-07-07 Updated: 2017-02-17 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.3.12, 5.5 |
| Fix Version/s: | 10.2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
See testcase and details in I'm not sure if this is actually a bug (i.e. here we have a situation where the optimizer had sufficient info to make the right decision but didn't make it). This needs to be investigated. |
| Comments |
| Comment by Dan Vande More [ 2012-01-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup I occasionally run into areas where maria attempts to semijoin and it will cause the query to be 1 or more orders of magnitude slower. Unfortunately, about 1/10 as often I find that semijoin makes some painful queries wickedly fast, so I am forced to leave it on in some cases. You have this marked as low priority but I would really like to see this fixed for maria 5.3. I do consider this a major bug but semijoin is too optimistic about it's chances to handle some things and can wreak havoc on queries even mysql 5.5 can do faster. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-01-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup The slowdowns you're seeing may be different from the problem that caused this bug. We have also found and are working on BUG#913030, BUG#914569. Any chance you could provide us (=mariadb team) with EXPLAIN EXTENDED outputs for cases where semi-join execution was slower than non-semijoin execution? Ideally, we would like to have the datasets, too. If the dataset cannot be made public, we have ftp.askmonty.org specifically set up to allow data uploads that can be visible only by Monty Program Ab staff. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dan Vande More [ 2012-01-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup I have been given approval to spend some time on reproducing this, you will hear from me over the next few days whether or not I can provide you with the needed info. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dan Vande More [ 2012-02-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup Unfortunately when I had this problem I failed to record the exact query & optimizer_switch, so I am unable to reproduce the issue at this time. I know I am definitely having it, but the 3:30am calls to fix a server that's being I/O starved typically mean I'm in a rush to just fix it. I will definitely post back when I have full details, but as of now you shouldn't wait on me to provide any meaningful data. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-03-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-03-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup A slightly simplified query from the report (converted LEFT JOIN to inner join since it was converted internally anyway): select * from CountryLanguage where (Language, Country) IN (SELECT City.Name, Country.Code FROM City, Country WHERE Country = Code and Code > 'LLL'); With semijoin=on, EXPLAIN is different on current 5.3:
---
--- with semijoin=off, I get:
---
--- Query execution times: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-03-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup MariaDB [bug806894]> show table_statistics;
-------------
------------- MariaDB [bug806894]> show index_statistics;;
-------------
------------- This means that Per-table counters count sucessful read ops. Key lookups that found nothing are ---------------------------
--------------------------- .. which are caused by: table | Handler_read_key | Handler_read_next | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-03-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup select * Apparently, one will never get matches when they look for City.Name= CountryLanguage.Language. On the other hand, in the subquery's join SELECT City.Name, Country.Code FROM City, Country WHERE Country = Code and Code > 'LLL' either table will have matches. Condition "City.Country=Country.Code" is the join intended by the dataset, each city lies within some existing country, and each country has some cities. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-03-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2012-03-21 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: SJ-Materialization picks scan-strategy which is 2x slower than SJ-Materialization lookup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rasmus Johansson (Inactive) [ 2012-03-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Launchpad bug id: 806894 |