Subject Simple Performance question
Author Robert martin

I am wanting to do two queries to see it an 'ItemRef' is in use in
either of two ways. I know I can run two separate queries or I can run
one query which is a UNION of the two (See below). Which will give me
better performance, running two simple queries or one more complex query.

Please note that I am assuming most of the time this query will return
no results so I don't anticipate a big saving from having to run only
one of the two simple queries.

FROM Stockbin sb
JOIN Item i ON i.ItemTypeRf = sb.ItemTypeRf
WHERE sb."Active" = 'T'
AND i.ItemRef = 34
SELECT FIRST 1 sbi.StkBinRef
FROM StockbinItem sbi
JOIN StockBin sb2 ON sb2.StkBinRef = sbi.StkBinRef
WHERE sb2."Active" = 'T'
AND sbi.ItemRef = 34

TIA :)

Rob Martin
Software Engineer

phone +64 03 377 0495
fax +64 03 377 0496

Wild Software Ltd