November 9, 2008 at 8:06 am
I have the following Query:
SELECT ArticleID,
Articleheadline
FROM Articles
((@ArticlesIDs IS NULL) or (Articles.ArticleID IN (select value from dbo.Split(@ArticlesIDs,','))))
Where Split is predefined function split the array items.
my question is: i use IN to select records, as performance is it good or i should do it in defferent way.
Regards;
November 9, 2008 at 9:07 am
The IN function expands to a series of ORs for each value. Performance depends on how many you have and how you are indexed, as well as the data distribution.
you might be better splitting the array into a table variable and joining the data.
November 9, 2008 at 12:46 pm
Thanks, but im new to DB development, so can u send me some references for indexing, and distribution
Thanks again
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply