Covering Indexes: Not Just for SELECT but also for UPDATE statements

  • Comments posted to this topic are about the item Covering Indexes: Not Just for SELECT but also for UPDATE statements

    Mike Byrd

  • I recently had a similar issue with a scratch table.  One of my predecessors had created a scratch table to perform intermediate sums and verify that in/out times added up to the total reported time.  Recently we have been receiving deadlock errors from the application, third party software.   My initial thought was why is it deadlocking now nothing has changed, then I realized that the only time it became an issue was on Monday mornings when everybody submitted their time.  Ah, a traffic issue!  My research pointed to a lack of a primary key on the scratch table causing a table lock to be applied for the updates and deletes.  I added a primary key to the table and the problem was solved.  Lesson learned, always define a primary key it makes everything more efficient not just faster.

  • Mike you have Query Cost statistics throughout your post. How are you calculating that?

  • From the estimated query plan.  Statistics were up to date, so estimated rows were close to actual rows.

    Mike Byrd

  • Thanks.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply