MySQL Forums
Forum List  »  General

count (*) performs very slow in mysql 8
Posted by: robert hofer
Date: March 24, 2021 08:48AM

Im am running a project in myslq 5.7 on a windows server.
For the benefit of enhanced statements like window statements i migrated to mysql 8.0.20.
The first problem after migration is: a count(*) over 100'000 records takes 15 seconds. Inf 5.7 it tooks about 0.1 second.

after testing an comparing i found out that it has nothing to do with the record number (same result with just 2 records),but adding an extra index to the primary key field (id) helped. It was not necessarie in previous versions.

Options: ReplyQuote

Written By
count (*) performs very slow in mysql 8
March 24, 2021 08:48AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.