Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Server SLOW results for specific (smaller) date range

Posted on 2011-02-15
3
Medium Priority
?
349 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:
Ephraim Wangoya earned 2000 total points
ID: 34900623

Check if you have created proper index on LoggedInDate
0
 

Author Comment

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

Author Comment

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

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

877 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