Active
Project:
Boost
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Feb 2011 at 19:35 UTC
Updated:
8 Feb 2011 at 19:35 UTC
boost_cache_directory() runs the following query:
SELECT count(DISTINCT base_dir) FROM {boost_cache}
In MySQL < 5.5, SELECT COUNT(DISTINCT(xyz)) has really bad performance.
http://bugs.mysql.com/bug.php?id=21849
Run against a boost_cache table in MySQL 5.1 SP1 Enterprise with about 800,000 records, this query takes 7 seconds. The suggested alternate is this:
SELECT COUNT(*) FROM (SELECT DISTINCT base_dir FROM {boost_cache} GROUP BY base_dir) AS counted;
Note that an alias ("AS counted") is required. This query takes 1-2 seconds on the same test database. Changing this query can significantly improve performance for a large user base.