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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query timeouts solution
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

162 Posts

Posted - 11/01/2010 :  16:16:00  Show Profile  Reply with Quote
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?

Almighty SQL Goddess

38200 Posts

Posted - 11/01/2010 :  16:17:57  Show Profile  Visit tkizer's Homepage  Reply with Quote
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

Subscribe to my blog
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000