Wednesday, March 7, 2012

call function for inner join

I have a procedure which has query

like Query 1.

Query 1

Select Clinetid

from clinet

inner join {

select centerid from GetChildCenter(@.Centerid)

union

select centerid from getParentCenter(@.Centerid)

} as Center c

on c.Centerid = client.Centerid

Query 2

declare @.Center table ( centerid int)

insert into @.Center

select centerid from getchildCenter(@.Centerid) union all select centerid from getparentcenter(@.Centerid)

Select Clinetid

from clinet

inner join @.Center c on c.Centerid = client.Centerid

I just want to know which one is better performance wise..

because there is millions of rows for table center which is used by function getChildCenter() and GetparentCenter()

Did you compare execution plans and IO statistics?

AMB

No comments:

Post a Comment