|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Performance between SP3 and SP4SELECT 1 FROM DAT_SAMPLES D , WRK_SELECT W WHERE W.TRANSACTIONID = 53364 AND D.ID = W.RECORDID AND D.APPROVAL IS NOT NULL AND NOT ( D.APPROVAL = 1 AND D.APPROVEDBY = 'SYSTEM' ) There are approx 350000 records in DAT_SAMPLES with a clustered index on ID and 1 record in WRK_SELECT Executing the above query in SQLServer 2000 with SP3 takes < 1 second Executing the same query against the same database connected to SQLServer 2000 SP4 take approx 30 seconds Looking at the execution plans SP3 performs a Nested Loop/inner join, but SP4 performs a Merge Join/Inner Loop I have attempted to rewrite the query using EXISTS and IN with the same results. Has anybody else come across similar performance issues with SP4 Having you made sure that statistics are up to date on both servers/databases?
I do recall having read about different algorithms being used between SPs, but can't remember which SPs (might have been 2 & 3.) Also, might a FROM...WITH help? Show quoteHide quote "Warren" wrote: > We have the following select statement > > SELECT 1 FROM DAT_SAMPLES D , WRK_SELECT W > WHERE W.TRANSACTIONID = 53364 > AND D.ID = W.RECORDID > AND D.APPROVAL IS NOT NULL > AND NOT ( D.APPROVAL = 1 AND D.APPROVEDBY = 'SYSTEM' ) > > There are approx 350000 records in DAT_SAMPLES with a clustered index > on ID > and 1 record in WRK_SELECT > > Executing the above query in SQLServer 2000 with SP3 takes < 1 second > Executing the same query against the same database connected to > SQLServer 2000 SP4 take approx 30 seconds > > Looking at the execution plans SP3 performs a Nested Loop/inner join, > but SP4 performs a Merge Join/Inner Loop > > I have attempted to rewrite the query using EXISTS and IN with the same > results. > > Has anybody else come across similar performance issues with SP4 > > I had updated all statistics and also tried a FROM... WITH, neither had
any effect. I have identified the problem being that the WRK_SELECT.RECORDID is a DECIMAL(10,0) and the DAT_SAMPLES.ID is a DECIMAL(9,0). This did not cause any problem with SP3, but with SP4 it only works if I change RECORDID to DECIMAL(9,0), or use CONVERT in the query.
Bitwise or aggregate function
Table format change Max() on many columns performs slowly Query in SP3a retreives result in different order in SP4 Format numbers in a view Search all Varchar fields in Database for text Having condition Question about CASE Service Broker queues Executing a command inside a read loop |
|||||||||||||||||||||||