I have a test case now. It turns out that some queries take 30-50 seconds instead of the usual 0.02.
It doesn’t always get stuck, when I run it, but most of the time. I experimented with the optimizer_switch line a bit. Regardless of the use_index_extension setting, it will break down sooner or later.
I have set it up so that I can instantly switch between multiple versions of Percona server; they are operating on the same InnoDB files even. This is not necessary for reproduction, though.
Excerpt from output with Percona Server 5.5.27:
0.0422 seconds 515
0.0289 seconds 602
0.0466 seconds 760
0.0264 seconds 663
0.0412 seconds 652
0.0455 seconds 551
0.0298 seconds 644
0.0437 seconds 623
0.0447 seconds 704
0.0446 seconds 567
0.0253 seconds 546
0.0376 seconds 609
0.0431 seconds 534
0.0541 seconds 760
0.0324 seconds 561
0.0273 seconds 644
0.0413 seconds 508
0.0445 seconds 628
0.0444 seconds 658
0.0296 seconds 578
…
And with Percona Server 5.6.14:
0.0259 seconds 500
0.0318 seconds 500
0.0317 seconds 500
0.0226 seconds 500
0.0216 seconds 500
0.0317 seconds 500
0.0320 seconds 500
0.0319 seconds 500
0.0336 seconds 500
0.0337 seconds 500
18.6618 seconds 500 ← !!
((1L, ‘SIMPLE’, ‘EI’, ‘ref’, ‘PRIMARY,version’, ‘version’, ‘8’, ‘const’, 500L, ‘Using index condition; Using where’),)
0.0428 seconds 500
0.0570 seconds 500
0.0570 seconds 500
27.5641 seconds 500 ← !!
((1L, ‘SIMPLE’, ‘EI’, ‘ref’, ‘PRIMARY,version’, ‘version’, ‘8’, ‘const’, 500L, ‘Using index condition; Using where’),)
30.4068 seconds 500 ← !!
((1L, ‘SIMPLE’, ‘EI’, ‘ref’, ‘PRIMARY,version’, ‘version’, ‘8’, ‘const’, 500L, ‘Using index condition; Using where’),)
35.4683 seconds 500 ← !!
((1L, ‘SIMPLE’, ‘EI’, ‘ref’, ‘PRIMARY,version’, ‘version’, ‘8’, ‘const’, 500L, ‘Using index condition; Using where’),)
0.0230 seconds 500
44.6238 seconds 500 ← !!
((1L, ‘SIMPLE’, ‘EI’, ‘ref’, ‘PRIMARY,version’, ‘version’, ‘8’, ‘const’, 500L, ‘Using index condition; Using where’),)
44.7074 seconds 500 ← !!
((1L, ‘SIMPLE’, ‘EI’, ‘ref’, ‘PRIMARY,version’, ‘version’, ‘8’, ‘const’, 500L, ‘Using index condition; Using where’),)
44.8300 seconds 500 ← !!
((1L, ‘SIMPLE’, ‘EI’, ‘ref’, ‘PRIMARY,version’, ‘version’, ‘8’, ‘const’, 500L, ‘Using index condition; Using where’),)
0.0296 seconds 500
45.2974 seconds 500 ← !!
((1L, ‘SIMPLE’, ‘EI’, ‘ref’, ‘PRIMARY,version’, ‘version’, ‘8’, ‘const’, 500L, ‘Using index condition; Using where’),)
0.0311 seconds 500
0.0321 seconds 500
37.1574 seconds 500 ← !!
((1L, ‘SIMPLE’, ‘EI’, ‘ref’, ‘PRIMARY,version’, ‘version’, ‘8’, ‘const’, 500L, ‘Using index condition; Using where’),)
0.0266 seconds 500
…
During a typical run, after a minute or so, “show processlist\G” shows something like this:
*************************** 5. row ***************************
Id: 44
User: sr
Host: my_host:43457
db: sr_test
Command: Query
Time: 26
State: Sending data
Info: select * from EI where 0=1 or (target=52208912 and version=1905371148) or (target=52208913 and versi
Rows_sent: 496
Rows_examined: 0
*************************** 6. row ***************************
Id: 45
User: sr
Host: my_host:43460
db: sr_test
Command: Query
Time: 26
State: Sending data
Info: select * from EI where 0=1 or (target=52207637 and version=1905371148) or (target=52207638 and versi
Rows_sent: 496
Rows_examined: 0
*************************** 7. row ***************************
Id: 46
User: sr
Host: my_host:43463
db: sr_test
Command: Query
Time: 27
State: Sending data
Info: select * from EI where 0=1 or (target=52206994 and version=1905371148) or (target=52206995 and versi
Rows_sent: 496
Rows_examined: 0
*************************** 8. row ***************************
Id: 47
User: sr
Host: my_host:43468
db: sr_test
Command: Query
Time: 21
State: Sending data
Info: select * from EI where 0=1 or (target=52211510 and version=1905371148) or (target=52211511 and versi
Rows_sent: 496
Rows_examined: 0
*************************** 9. row ***************************
Id: 48
User: sr
Host: my_host:43472
db: sr_test
Command: Query
Time: 22
State: Sending data
Info: select * from EI where 0=1 or (target=52210867 and version=1905371148) or (target=52210868 and versi
Rows_sent: 496
Rows_examined: 0
The buffer pool size does not seem to be relevant. I have been able to reproduce with 512M, 1G, 3G. The my.cnf configuration file and the Python script can be found here: [url]https://github.com/Ringdingcoder/dumpingground/tree/master/percona[/url], a dump of the test database here: [URL]Home | Trayport
Steps to reproduce:
- Load dump into a database of your choosing (mine is called sr_test).
- Adjust connection parameters in the get_cursor function in test.py.
- Run python2 test.py
- Let it run for a few minutes.