Bug #3904 COUNT DISTINCT performance anomaly in 4.1
Submitted: 27 May 2004 2:07 Modified: 9 Jun 2004 23:37
Reporter: Dean Ellis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.2 OS:Linux (Linux)
Assigned to: Konstantin Osipov CPU Architecture:Any

[27 May 2004 2:07] Dean Ellis
Description:
4.1.2 processes a particular COUNT(DISTINCT ...) type of query dramatically slower than 4.0.20.  You can watch the speed with which the temp file is created to get an idea of just how much slower.

How to repeat:
CREATE TABLE t1 ( a text, b char(1) );

Load with random data (100K rows should be enough to demonstrate).

SELECT COUNT(DISTINCT b, a) FROM t1;
SELECT COUNT(DISTINCT a, b) FROM t1;

Both are processed reasonably quickly in 4.0.  The latter is orders of magnitude slower in 4.1, though the former remains quick.

Suggested fix:
n/a
[9 Jun 2004 20:53] Konstantin Osipov
bk commit - 4.1 tree (konstantin:1.1912) BUG#3904
[9 Jun 2004 23:37] Konstantin Osipov
Fixed in 4.1.3