Sorry for the long reply:

At 02:57 PM 6/10/2002 -0500, you wrote:
>[snip]
>SELECT
>         head.po
>FROM
>         head
>         LEFT JOIN line ON (head.sn=line.snHead)
>WHERE
>         head.po > 1
>         AND line.dateETA<='2002-06-10'
>LIMIT 50
>
>As is, this query is very fast (0.01 seconds when there are 25,000 records
>in 'head', and 50,000 records in 'line').  However, when I change the query
>to search on line.dateETA ">=" or even "=" [somedate], the query takes a
>long time to return (2-3 seconds).
>
>The line.dateETA field is indexed.  And, for both "<=" and ">=" queries,
>EXPLAIN returns the same information.
>[/snip]
>
>Since head.po is the return item here, indexing it will speed up the query.
>HTH!
>Jay
>sql, mysql, query


head.po is already indexed (as are head.sn and line.snHead), but I'm not so 
sure that indexing the "other" fields is the issue since the query is very 
fast in the "<=" case.

Thanks,
Matt



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to