Bug #101107 | Using VIEW with a prepared statement makes MySQL very slow | ||
---|---|---|---|
Submitted: | 9 Oct 2020 15:24 | Modified: | 5 Nov 2020 17:28 |
Reporter: | Masahiro Tomita | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Prepared statements | Severity: | S3 (Non-critical) |
Version: | 8.0.21 | OS: | Ubuntu |
Assigned to: | CPU Architecture: | Any |
[9 Oct 2020 15:24]
Masahiro Tomita
[12 Oct 2020 12:14]
MySQL Verification Team
Hello Mr. Tomita, Thank you for your bug report. However, what you describe is, actually, expected behaviour. If you read our documentation on the statement reset, it actually clears lots of buffers and hence a new run must be slower. Also, if you read our documentation on the VIEWs, you will see that those are actually NOT replacements for the TABLEs. Unlike a direct work with tables, using views requires several additional operations. Views are here to make programming easier and not to make it as fast. Not a bug.
[13 Oct 2020 1:46]
Masahiro Tomita
This does not indicate that it is slow, but that it gradually slows down as it repeats. count sec qps 1000 0.116 8620.854 ... 10000 0.440 2272.771 ... 20000 0.688 1453.517 ... 30000 1.168 856.181 ... 40000 1.432 698.338 ... 50000 1.692 591.028
[13 Oct 2020 12:29]
MySQL Verification Team
Hi Mr. Tomita, This phenomenon has the same explanation as the one provided. More buffers get cleared and more temporary tables get created. Not a bug.
[5 Nov 2020 17:28]
Masahiro Tomita
This has been fixed in MySQL 8.0.22. Results at 8.0.22: % docker exec -it mysql80 ./a.out count sec qps 1000 0.108 9259.460 2000 0.104 9615.575 3000 0.104 9615.597 4000 0.104 9615.597 5000 0.100 10000.200 6000 0.104 9615.597 7000 0.108 9259.460 8000 0.100 10000.224 9000 0.100 10000.200 10000 0.108 9259.460 11000 0.100 10000.224 12000 0.108 9259.440 13000 0.100 10000.224 14000 0.112 8928.762 15000 0.104 9615.597 16000 0.104 9615.597 17000 0.104 9615.575 18000 0.100 10000.224 19000 0.100 10000.200 20000 0.104 9615.597 21000 0.100 10000.224 22000 0.100 10000.200 23000 0.104 9615.597 24000 0.100 10000.224 25000 0.112 8928.762 26000 0.096 10416.878 27000 0.132 7575.924 28000 0.100 10000.200 29000 0.104 9615.597 30000 0.100 10000.224 31000 0.108 9259.460 32000 0.100 10000.200 33000 0.104 9615.597 34000 0.100 10000.200 35000 0.104 9615.597 36000 0.112 8928.762 37000 0.096 10416.904 38000 0.104 9615.575 39000 0.104 9615.597 40000 0.096 10416.904 41000 0.104 9615.575 42000 0.100 10000.224 43000 0.100 10000.200 44000 0.104 9615.597 45000 0.100 10000.224 46000 0.104 9615.575 47000 0.104 9615.597 48000 0.096 10416.904 49000 0.108 9259.440 50000 0.104 9615.597
[6 Nov 2020 12:33]
MySQL Verification Team
Thank you for the feedback.