I've the same problem with sub-selects too. 
One way to resolve this problem is creating index on the attribute that you are
using in the sub-select (in your case, you are doing a full scan, so the index
don't works). 
Another way is re-creating the query. You can transform the sub-select in a join
like this:

SELECT T.*, C.NAME FROM arTAGIH T, arCUSTOMER C, arBILL_LNS B WHERE
 T.BILL_NO != B.BILL_NO 
AND T.CUST_CODE ...

(I don't know if this will resolve your problem :/)

But i think that MySQL have some problems with optimizing sub-select.


Alexis Guia



Quoting DenBaguse MasRodjie <[EMAIL PROTECTED]>:

> I'm using MySQL-4.1 alpha because it's support sub-select.
> But i've tried and the result takes very long time (more then 30 seconds).
> The query is:
>    SELECT T.*, C.NAME FROM arTAGIH T, arCUSTOMER C, arBILL_LNS WHERE
> T.BILL_NO NOT IN (SELECT BILL_NO FROM arBILL_LNS) 
>    AND T.CUST_CODE=C.CUST_CODE AND T.D_R=arBILL_LNS.D_R AND T.CUST_CODE='ABA'
> ORDER BY T.TANGGAL"
> The comparison, using MySQL takes 80 seconds, and using MSDE not more than 5
> seconds.
> Is there something wrong with that query or it's true that MySQL has limited
> ability for sub-select
> 
> 
> Thank's
> 
> Roji



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

Reply via email to