[MDEV-588] LP:1005898 - index_merge/intersection is used when ref(const) is faster Created: 2012-05-29 Updated: 2017-10-16 Resolved: 2017-10-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 5.2.14, 5.3.12 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The queries were provided by Stephane Varoqui:
The dataset is lots.tgz, uploaded to ftp.askmonty.org/private/ EXPLAIN outputs and query time:
As one can see, index_merge/intersect is about 1.85/0.30=6 times slower than ref access on contractNumber. |
| Comments |
| Comment by Sergei Petrunia [ 2012-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: index_merge/intersection is used when ref(const) is faster Total rows: 2 137 152
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: index_merge/intersection is used when ref(const) is faster MariaDB [lots]> explain SELECT count
---
--- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: index_merge/intersection is used when ref(const) is faster MariaDB [lots]> explain SELECT count
---
--- MariaDB [lots]> explain SELECT count
---
--- MariaDB [lots]> explain SELECT count
---
--- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: index_merge/intersection is used when ref(const) is faster | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: index_merge/intersection is used when ref(const) is faster contractNumber='1478876' As a result, we have: === Index Merge T@10 : | | | | | | | | | | | >ror_intersect_add T@10 : | | | | | | | | | | | >ror_intersect_add | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: index_merge/intersection is used when ref(const) is faster | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: index_merge/intersection is used when ref(const) is faster The real value of the multiplier is 0.3. If I set that, I ge this plan:
#rows is closer to reality now (8580 is closer to the real value of 10,000), but still, index_merge is chosen. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2012-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Re: index_merge/intersection is used when ref(const) is faster Range access costs
handler::read_time() + #rows / TIME_FOR_COMPARE index_merge costs:
handler->keyread_time(index1, ...) + handler->keyread_time(index2, ...) + get_sweep_read_cost(...) note that the formula only includes index costs, #rows / TIME_FOR_COMPARE was not added. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rasmus Johansson (Inactive) [ 2012-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Launchpad bug id: 1005898 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-09-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
psergey, is that still an issue? |