Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 26th, 2004, 03:32 PM
Registered User
 
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Strange runtime problem

I am running a simple SQL view that obtains data from two tables joined together to return all activity for a specific address for a specified time period. When I run, I receive the following run times for different time periods (all else is the same):

Month of October < 1 second
Month of September < 1 second
Both together > 45 seconds
9/1/2004 > 10/5/2006 < 1 second
9/1/2004 > 10/6/2004 > 45 seconds
9/2/2004 > 10/6/2004 < 1 second
9/3/2004 > 10/7/2004 > 45 seconds

Fast server, 4 processors, 2+ gig of memory, less than 5 active users.
Above times are consistant (multiple runs give same results).
Same results from program using view or through sql manager.

Small amount of data, only about 30 records are returned.
Run times go crazy once a certain threshold is reached.
Database has about 14 million records.
Indexes exist and have been recently updated for both address and date.
Server has not been rebooted in over a month.






Sephus S
 
Old October 26th, 2004, 03:34 PM
Registered User
 
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I left off one piece of information, using SQL Server 2000.

Sephus S
 
Old October 26th, 2004, 11:57 PM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Anantsharma Send a message via Yahoo to Anantsharma
Default

It would be much clear to me if u give the Query inside the View.

If are sure that Index and statistics are updated and also IndexDefragmentation is done,Usage are updated (DBCC UPDATEUSAGE) then I like to drop the Index and recreate. If still problem, I feel a need of index on the View itself.

Certain limitations are there on indexed view but in your case I feel that those limitations are not barrier.

Create a Clustered Index on the view itself.

Good luck...

B. Anant
 
Old October 30th, 2004, 10:38 PM
Registered User
 
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The view is:

SELECT tblCfsEvent.chrEventNumber, tblCfsEvent.dtDateTimeStart, tblCfsStreetName.chvStreetName
FROM tblCfsStreetName LEFT OUTER JOIN
                  tblCfsEvent ON dbo.tblCfsStreetName.ID =
                              tblCfsEvent.FK_insCfsStreetName
WHERE (tblCfsEvent.dtDateTimeStart > CONVERT(DATETIME, '2004-09-01 00:00:00', 102) AND tblCfsEvent.dtDateTimeStart < CONVERT(DATETIME,
                      '2004-10-15 00:00:00', 102)) AND (tblCfsStreetName.chvStreetName = 'Flora')


About 30 records are returned. If I use 10/5/2004 as the ending date, it runs in <1 second, if 10/6/2004 is used then it runs over 45 seconds and no additional records are returned.

As I just finished adding 7,000,000 records to the table a few weeks ago, I rebuilt all of the indexes. Since then, only about 10,000 records have been added to the file. The problem only started about a week back and it is very consistant.

The table holding the street names only has a table key and a street name and the table has about 10,000 entries.

I have run the same request in both the query analyzer and from SQL Manager and receive the same results. Requests continue to be very fast until I exceed some maximum size. The problem seems to be occurring on any requests using this database that exceed a certain size. At present, I do not know of any problems in any other of the databases on the server but all of the other applications have only a small percentage of as many records. As an example, I have a program run procedure, that searches three text fields in 60,000 records for the occurrance of specified text and it runs in under 2 seconds.

I will run DBCC UPDATEUSAGE when I get back to the office.

What do you mean by setting up a clustered index on the view?


S Cephus


Sephus S





Similar Threads
Thread Thread Starter Forum Replies Last Post
strange IE problem sully7 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 September 19th, 2008 08:44 AM
Strange problem... F3553 C++ Programming 1 October 25th, 2007 03:56 PM
Strange calculation problem blkskullwork Javascript 4 November 3rd, 2006 03:16 PM
kind of Really strange problem kalchev ASP.NET 2.0 Basics 1 March 22nd, 2006 03:32 PM
very strange problem! please help! raybristol ASP.NET 1.0 and 1.1 Basics 8 December 15th, 2005 06:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.