Bug #105029 Increased query time for "select count(distinct c)"
Submitted: 24 Sep 2021 5:37 Modified: 24 Sep 2021 12:45
Reporter: Souvik Dhargupta Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0. OS:Any
Assigned to: CPU Architecture:Any

[24 Sep 2021 5:37] Souvik Dhargupta
Description:
Running the query "select count(distinct c) on db1.sbtest1" on a sysbench table sbtest1, there is a ~2 min time difference b/w mysql:8.0.23 and mysql:5.7.34.

Mysql 80	Mysql 57
6 min 12.45 sec	4 min 22.70 sec

How to repeat:
Create a sysbench table with 50M rows and run the query on both of the mysql engine versions. The query time difference is visible.
[24 Sep 2021 12:45] MySQL Verification Team
Hi Mr. Dhargupta,

Thank you for your bug report.

We discovered that there are already a number of verified bugs that are reporting the slowdown of read-only queries between 5.7 and 8.0.

Hence, your report is a duplicate of the following verified bug :

https://bugs.mysql.com/bug.php?id=94387

Thank you very much.
[24 Sep 2021 15:49] Steinar Gunderson
Two questions:

- Does this also happen if you set the collation to the same thing (presumably latin1_swedish_ci) on both versions, or is it about the default collation being changed to a more CPU-intensive one?
- Does this also happen if you use VARCHAR instead of CHAR? (Nobody should really use CHAR anymore, including in sysbench. It is a relic from a time long since passed.)
[27 Sep 2021 12:25] MySQL Verification Team
This is, indeed, a very important question, since lots of slowdowns are due to the change in the default character set.