June 1, 2010 at 10:55 am
mberry 51447 (6/1/2010)
Nope it is SQL_Latin1_General_CP1_CI_AS
If the database is case insensitive, do you know why the vendor put an UPPER() function in the WHERE clause?
June 1, 2010 at 11:06 am
Brandie Tarvin (6/1/2010)
mberry 51447 (6/1/2010)
Nope it is SQL_Latin1_General_CP1_CI_ASIf the database is case insensitive, do you know why the vendor put an UPPER() function in the WHERE clause?
No clue. I didnt write it. But somehow I dont believe that use of the UPPER function is causing this.
June 1, 2010 at 11:11 am
mberry 51447 (6/1/2010)
somehow I dont believe that use of the UPPER function is causing this.
Every function included in a WHERE clause causes problems. It most instances, it can turn a set based query into a RBAR query. The more functions you have in a query, the more performance problems you have. So, removing every unnecessary function can only help you out.
That's the reason why Gail said:
Not much I can do about that update. Those functions in the where clause are going to kill it
June 1, 2010 at 11:12 am
So all the UPPER is doing is preventing index usage. Wonderful. No possibility of getting the query changed?
Ok, this is what I suggest for a first try:
Drop that unique nonclustered index and replace it with a primary key clustered
Drop all of the nonclustered indexes (this is assuming that the queries you've told me of are the only ones running against that table). There are far too many for a fast insert/update/delete table and they're all too narrow to be useful
Create a nonclustered index (FYI_DKEY, FYI_VER_MAJOR, FYI_VER_MINOR,FYI_SERVICE_CUSTOM)
Create a nonclustered index (FYI_SERVICE_TYPE, FYI_SERVICE_OWNER, FYI_PROCESS_TIME, FYI_SERVICE_SUBTYP)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 1, 2010 at 11:14 am
mberry 51447 (6/1/2010)
But somehow I dont believe that use of the UPPER function is causing this.
Maybe, maybe not. But it's not helping the situation at all. There's no way to get that update to fully use an index, because of the UPPER and the CONVERT.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 1, 2010 at 11:15 am
Brandie Tarvin (6/1/2010)
It most instances, it can turn a set based query into a RBAR query
You're thinking of UDFs which behave as cursors in disguise. All a built-in function will do is turn an index seek into an index scan, with the associated locking impact.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 1, 2010 at 11:28 am
Ok. I have added the indexes. but the first one is a bit wide. I got the following:
Warning! The maximum key length is 900 bytes. The index 'IX_TEMP1' has maximum length of 2012 bytes. For some combination of large values, the insert/update operation will fail.
June 1, 2010 at 11:30 am
Also keep in mind the main deadlocks I see are only invloving the deletes. not the update even though the update runs frequently it is not a node of the chain 90% of the time
June 1, 2010 at 11:47 am
mberry 51447 (6/1/2010)
Ok. I have added the indexes. but the first one is a bit wide. I got the following:Warning! The maximum key length is 900 bytes. The index 'IX_TEMP1' has maximum length of 2012 bytes. For some combination of large values, the insert/update operation will fail.
Not good.
Ok, change that one to this:
(FYI_DKEY, FYI_VER_MAJOR, FYI_VER_MINOR) INCLUDE (FYI_SERVICE_CUSTOM)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 1, 2010 at 11:51 am
OK. Thanks for your help. I should see deadlocks tonight if it doesnt work. I will let you know. Thanks so much for your help!
Viewing 10 posts - 16 through 24 (of 24 total)
You must be logged in to reply to this topic. Login to reply