Bug #96233 | MySQL Questions per second is decreasing with higher number of table partitions | ||
---|---|---|---|
Submitted: | 17 Jul 2019 13:28 | Modified: | 19 Jul 2019 12:47 |
Reporter: | Uday Sitaram | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Partitions | Severity: | S4 (Feature request) |
Version: | 5.7.26 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | High Disk IO, MySQL Performance, partitions, slow |
[17 Jul 2019 13:28]
Uday Sitaram
[17 Jul 2019 13:54]
MySQL Verification Team
Hi Mr. Sitaram, Thank you for your bug report. First, this is not a bug , but a feature request. This is because you are asking for the improvement in our Optimiser plan choice. Before continuing, could you please send us the output from EXPLAIN EXTENDED for both queries. While, doing that, please try omitting " AND RAND() < 0.01 " from your query.
[17 Jul 2019 23:10]
Dongchan Sung
Hi Sinisa, I have question. :-) Is this not the case when mysql have already selected index that executed the query? If so, I think that there is no need to turn around in the execution plan situation though it is data to access anyway. Best Regards, Chan.
[18 Jul 2019 12:59]
MySQL Verification Team
HI Sung, This is not so much about index choice, but about a need to count rows in each partition. Also, we shall know more after we get that EXPLAIN ........
[19 Jul 2019 6:26]
Uday Sitaram
Sinisa, Here are respective explain plans. tbl1 has 12 partitions while tbl2 has just 3 for the same dataset. ============================= mysql> explain extended SELECT * FROM tbl1 WHERE COL01 > 'value from Query1' AND RAND() < 0.01 ORDER BY PAR_DATE DESC LIMIT 10; +----+-------------+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+---------------+---------+---------+------+------+----------+-----------------------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+---------------+---------+---------+------+------+----------+-----------------------------+ | 1 | SIMPLE | tbl1 | PF_201801,PF_201802,PF_201803,PF_201804,PF_201805,PF_201806,PF_201807,PF_201808,PF_201809,PF_201810,PF_201811,PF_201812,PF_201813,PF_201814,PF_201815,PF_201816 | range | PRIMARY | PRIMARY | 66 | NULL | 1 | 100.00 | Using where; Using filesort | +----+-------------+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+---------------+---------+---------+------+------+----------+-----------------------------+ 1 row in set, 2 warnings (0.00 sec) mysql> explain extended SELECT * FROM tbl2 WHERE COL01 > 'value from Query1' AND RAND() < 0.01 ORDER BY PAR_DATE DESC LIMIT 10; +----+-------------+--------+-------------------------------+-------+---------------+---------+---------+------+------+----------+-----------------------------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+--------+-------------------------------+-------+---------------+---------+---------+------+------+----------+-----------------------------+ | 1 | SIMPLE | tbl2 | PF_201801,PF_201802,PF_201803 | range | PRIMARY | PRIMARY | 66 | NULL | 1 | 100.00 | Using where; Using filesort | +----+-------------+--------+-------------------------------+-------+---------------+---------+---------+------+------+----------+-----------------------------+ 1 row in set, 2 warnings (0.00 sec) =============================
[19 Jul 2019 12:26]
MySQL Verification Team
Hi Mr. Sitaram, Everything is much more clear now. However, we would like to see those two warnings !!!
[19 Jul 2019 12:27]
MySQL Verification Team
Hi, One more thing. Can you please ANALYZE both tables before running the queries .....
[19 Jul 2019 12:43]
Uday Sitaram
Sinisa, I have re run those queries preceding an ANALYZE table operation. Those warnings are general and expected. I am attaching the details in the attachment. Please have a look at it.
[19 Jul 2019 12:44]
Uday Sitaram
warnings information along with explain after analyze
Attachment: 96233_details_July19th.txt (text/plain), 9.07 KiB.
[19 Jul 2019 12:47]
MySQL Verification Team
Hello Mr. Sitaram, Thank you for your feedback. We are verifying this report as a very useful feature request !!!!! Thanks ....