It sounds like you are looking for a quickie. Sorry, couldn't resist.

You should run optimize table to make sure your indexes are optimized. Also, you should check which index is being used first. Your sex column probably is split 50/50, so if MySQL is optimizing your query to use the sex index first, it will take a long time.

On Jan 19, 2004, at 10:20 AM, Balazs Rauznitz wrote:

When searching on 'id' everything is snappy:

mysql> select count(*) from sex where id>459000 and id <=460000;
+----------+
| count(*) |
+----------+
|     1000 |
+----------+
1 row in set (0.00 sec)

However when the 'sex' column is involved:

mysql> select count(*) from sex where id>459000 and id <=460000 and sex = 'M';
+----------+
| count(*) |
+----------+
| 504 |
+----------+
1 row in set (5.09 sec)


Any way to make this faster ?

<Insert jokes about sex making MySQL slow here>

I'm running MySQL 4.0.16 on a 1GHz AMD CPU under linux.

Thanks,

Balazs

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


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



Reply via email to