August 10, 2010 at 10:07 am
Please post table definitions, index definitions and execution plan, as per http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 15, 2010 at 1:41 pm
Hi There,
Changing the query to explicit INNER JOINs with ON statements might prevent improper execution plan.
In your current query, their might be a possibility that SQL first joins all tables and then applies a filter.
By explicitely using INNER JOIn with ON, you will be sure that the tables are pre-filtered before the are joined. As a result less I/O will be needed.
Hope this will help you out.
Kind regards,
Dave
August 15, 2010 at 1:45 pm
By the way,
Also I should get rid of the "TOP 100 percent" if you don't use it.
Kind regards,
Dave
August 15, 2010 at 9:25 pm
Dave Hoogendoorn (8/15/2010)
Hi There,Changing the query to explicit INNER JOINs with ON statements might prevent improper execution plan.
In your current query, their might be a possibility that SQL first joins all tables and then applies a filter.
By explicitely using INNER JOIn with ON, you will be sure that the tables are pre-filtered before the are joined. As a result less I/O will be needed.
Hope this will help you out.
Kind regards,
Dave
Do you have a coded example that shows such a thing?
--Jeff Moden
Change is inevitable... Change for the better is not.
August 16, 2010 at 9:08 am
All depends on how many rows you have in each table, which columns are indexed etc - i agree with previous post - not using INNER JOIN won't be helping
Sometimes SQL Server doesn't go the right way on a join i.e. pick the smallest dataset to start with. Using sub-selects in the SELECT and FROM sections can help it to make the correct decision, but the answer lies in knowing the data, indexes etc.
August 16, 2010 at 12:22 pm
Please follow Gail's recommendations and then we dont have to guess...
with the above requested info we can give you an answer very quickly
Viewing 6 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply