Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

SQL Server SLOW results for specific (smaller) date range

I have a view that is comprised of another view and a table. It has 13,493 records. Not that big.

When I do a select ALL records, it takes about 3 seconds to return the dataset.

When I add a WHERE  (LoggedInDate >= '1/1/2010') AND (LoggedInDate <= '12/31/2010') it takes about 3 seconds to return the dataset of 11,172 records.
When I add a WHERE  (LoggedInDate >= '1/1/2011') AND (LoggedInDate <= '12/31/2011')  it takes about 15 seconds to return the dataset of 2,316 records.  At the bottom where it shows # of records its pulling it looks like it is chunking results in sets of 256 at a time.

I traced it back month by month and it looks like it starts this 'chunking' data results for anything loggedindate > 12/15/2010. The LoggedInDate is a datetime field. I checked other views, tables AND even those in different databases and realized that it was happenning to all of them.

Any ideas? Is there a process that was started that is stuck that I may not be seeing?
0
Norm-al
Asked:
Norm-al
  • 2
1 Solution
 
Ephraim WangoyaCommented:

Check if you have created proper index on LoggedInDate
0
 
Norm-alNetwork EngineerAuthor Commented:
I hate to ask this but how do I know if its proper indexing?
0
 
Norm-alNetwork EngineerAuthor Commented:
Nevermind, got it and it runs in a few seconds, thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now