Sam,
Can you send the output of the following:
#>explain <your query>\G
Clint
From: sam wun <[EMAIL PROTECTED]>
To: mysql@lists.mysql.com
Subject: sub query is extermely slow
Date: Wed, 19 Jan 2005 20:02:37 +0800
Hi list,
The following sql statement takes 3 mintues to complete the query. How can
I improve its speed?
select DISTINCT i.basename from inventory i, transaction t, customer c
where i.prodcode = t.prodcode and c.custcode = t.custcode and i.basename is
not NULL and i.prodname is not NULL and ((date(t.date) >= "2004-01-01" and
date(t.date) <= "2004-01-31") and i.basename IN (select DISTINCT
ii.basename from inventory ii, transaction tt, customer cc where
ii.prodcode = tt.prodcode and cc.custcode = tt.custcode and ii.basename is
not NULL and ii.prodname is not NULL and(date(tt.date) >= "2005-01-01" and
date(tt.date) <= "2005-01-31"))) order by i.basename
Thanks
Sam
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]