4 messages in com.mysql.lists.mysqlRe: Slow ORDER BY| From | Sent On | Attachments |
|---|---|---|
| Clinton Pells | 06 Dec 1999 11:45 | |
| Clinton Pells | 06 Dec 1999 14:58 | |
| Sasha Pachev | 06 Dec 1999 15:12 | |
| Peter Strömberg | 07 Dec 1999 08:02 |
| Subject: | Re: Slow ORDER BY![]() |
|---|---|
| From: | Clinton Pells (ckpe...@ucdavis.edu) |
| Date: | 12/06/1999 02:58:49 PM |
| List: | com.mysql.lists.mysql |
This is a bit of a special problem as we are replicating a large existng database that is based on a COBOL type language. the table srtucture is designed to allow us to use existing clients but redirecting to a SQL server. What I don't understand is that:
mysql> select keycase,keydate,nm1fl from Log where nm1fl='BE EASY DOC' order by nm1fl limit 10; +-----------+---------+-------------+ | keycase | keydate | nm1fl | +-----------+---------+-------------+ | QH 100000 | 970106 | BE EASY DOC | +-----------+---------+-------------+ 1 row in set (0.40 sec)
comes back in a respectable time. If the table has a key on the nm1fl column then the next 10 should be able to be found by just getting the next 10 in the index. Instead it does a table scan or something. I'm still not sure why 'having' gives a response and 'where' starts thrashing.
mysql> select keycase,keydate,nm1fl from Log having nm1fl='BE EASY DOC' order by nm1fl limit 10; +-----------+---------+-------------+ | keycase | keydate | nm1fl | +-----------+---------+-------------+ | QH 100000 | 970106 | BE EASY DOC | +-----------+---------+-------------+ 1 row in set (14.06 sec)
and why does 'having' take so much longer with this same query?
-- Clinton Pells Veterinary Genetics Laboratory Bioinformaticist School of Veterinary Medicine ckpe...@ucdavis.edu University of California voice: (530) 754-4394 One Shields Avenue fax: (530) 752-3556 Davis, CA 95616




