Solved

SQL Server SLOW results for specific (smaller) date range

Posted on 2011-02-15
3
335 Views
Last Modified: 2012-05-11
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
Comment
Question by:Bianca
  • 2
3 Comments
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
Comment Utility

Check if you have created proper index on LoggedInDate
0
 

Author Comment

by:Bianca
Comment Utility
I hate to ask this but how do I know if its proper indexing?
0
 

Author Comment

by:Bianca
Comment Utility
Nevermind, got it and it runs in a few seconds, thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now