[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: faster select



Angel,

The IN is definitely the slower of the 2 selects.  Another solution to
your problem which might be faster is to choose the sub-query as your
driving select, and use an SQR procedure for the outer select, as
illustrated below.

--------------------------------------------------

begin-select DISTINCT
master-shop

   move &master-shop to $master-shop
   do shop_stuff($master-shop)

from ldsloc.dbo.tt_shop
....
end-select


begin-procedure shop_stuff($shop)

begin-select
shop

   ...

from tt_shop
where shop = $shop
....
end-select

end-procedure !shop_stuff

--------------------------------------------------

I always thought 2 seperate selects done in this way is faster than
using a subquery.  Perhaps I am wrong?  Anyone have any thoughts on
this?

Wes Bailey

Associate Consultant
Coopers & Lybrand Consulting
1100 Louisiana St., Suite 4100
Houston, TX  77002