[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 "Say sql, my sql at the beginning of that well known prose...and see the reaction." --------------------------------------------------------------------- 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