Ben,

----- Original Message -----
From: "Ben Dinnerville"
Sent: Monday, April 19, 2004 1:49 AM
Subject: RE: Slow Query Question - Need help of Gurus.



<snip>

>>Then try again:
>>
>>   SELECT `Call Svc Tag ID`,
>>           Count(*) as counter,
>>          `Journal Create Date`
>>   FROM 31909_859552
>>   WHERE `Journal Create Date` between '2004-03-13' AND  '2004-03-16'
>>   AND `Call Svc Tag ID`<>'null'
>>   GROUP BY `Call Svc Tag ID`
>>   HAVING counter > 3
>>   ORDER BY counter;

> The "count(*)" will be causing some havoc here, as all columns in the
> underlying table(s) will have to be read in, negating any direct hits
to the
> index's and causing a lot more IO than is needed. Change it to a count
on
> one of the columns in the result set or simply a "count(1) as
counter" -
> will give you the same result without any IO.

COUNT(*) is not a problem.  It won't cause the data file to be read if
just the index can be used.  EXPLAIN will show the same plan for
COUNT(*) and COUNT(1).  :-)


Matt


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to