Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query timeouts solution

Author  Topic 

tpiazza55
Posting Yak Master

162 Posts

Posted - 2010-11-01 : 16:16:00
I have a query that has a lot of joins on it that searches millions of records.

the majority of the searches only look through the data of the last 5 days, occasionally all the data.

what i tried to do was make a query that searches through the last 5 days data, if no records search through the all the records.

what Im finding is that the query that searches through all the reocrds is a little faster than one searching through the records with the last 5 days of data.

same query -- only difference is the additional search through the last 5 days in the where clause.

what is a good way to speed this type of scenario up?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-01 : 16:17:57
Could you post the query, DDL, plus indexes? Also could you post the execution plans of both?

Have you considered table partitioning?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -