Subject | Re: slow join query |
---|---|
Author | Adam |
Post date | 2006-09-09T10:37:20Z |
--- In firebird-support@yahoogroups.com, "flashjobs" <flashjobs@...>
wrote:
My guesses
-> 2=0
This will be evaluated for every record
-> NOT IN
By definition, not in will be expensive.
Adam
wrote:
>We don't know your database, what table does each field belong to?
> Hello all
>
> I have a problem that the query is very slow. Can anybody help?
>
> Thanks
>
> Shinelal
>
> SELECT PRODUCTCODE
> , PRODUCTNAME
> , PRODUCTCOSTLOCALCURRENCY
> , PRODUCTCOSTORGCURRENCY
> , PRODUCTISBN
> , PRODUCTBARCODE
> , PRODUCTSTOCKUPDATE
> , CURRENCYNAME
> , P.CURRENCYCODE
> , TAXDESCRIPTION
> , TAXPERCENTAGE
> , PRODUCTPUBLISHINGYEAR
> , SUPPLIERNAME
> , CURRENCYCONVERTRATE
> , CURRENCYLOCALASREF
> FROM (((PRODUCTMASTER P
> LEFT OUTER JOIN CURRENCYMASTER C ON C.CURRENCYCODE = P.CURRENCYCODE)
> LEFT OUTER JOIN TAXMASTER T ON T.TAXCODE = P.TAXCODE)
> LEFT OUTER JOIN SUPPLIERMASTER S ON S.SUPPLIERCODE=P.PUBLISHERCODE)
> WHERE PRODUCTSTOCKUPDATE = 'Y' AND
> ((PRODUCTCODE IN (SELECT PRODUCTCODE FROM STOCKMASTER WHERE
> OUTLETCODE=?OUTLET
> AND BRANCHCODE=?BRANCH )or 2=0) OR
> PRODUCTCODE NOT IN(SELECT PRODUCTCODE FROM STOCKMASTER))
>
My guesses
-> 2=0
This will be evaluated for every record
-> NOT IN
By definition, not in will be expensive.
Adam