Groups | Blog | Home
all groups > sql server (microsoft) > december 2006 >

sql server (microsoft) : Problem with Index locking table



aaronGerlich NO[at]SPAM gmail.com
12/29/2006 9:28:56 AM
Hi everyone,

I have been experiencing a problem that is locking up queries on some
of my db's. We do a lot of record updating, deleting, and inserting
with a good number of indexes and it appears as if occassionaly
something will happen to the table that causes all queries that use the
index to just halt in there tracks. It won't return an error but just
hang.

I have tried running a number of the dbcc maintenance scripts on the db
to try and figure out what table the problem is happening but all
return everything is ok. The only thing i have found to fix it, is to
reindex all the user tables.

I was wondering if anyone has any methods to determine what index this
may be happening on, so i don't have to reindex the whole db.

Ive tried
dbcc checkdb
dbcc checktable
dbcc dbrepair

none of these work, i have been using dbcc dbreindex(@tablename) and
running in a cursor of Usertables.

Thanks,
Aaron
bb_43 NO[at]SPAM hotmail.com
12/30/2006 12:54:34 AM
[quoted text, click to view]


Russ Rose
12/31/2006 8:51:07 AM

[quoted text, click to view]

For this answer I am translating "halt in their tracks" to blocking.
(Deadlocking, although similar, is more likely an application design issue.)

When blocking occurs I run sp_who2 which will list which spid are being
blocked and using that information find the root spid doing the blocking.
The I run sp_lock to find what exclusive locks are be held by that blocking
spid. This gives object id's on which the exclusive locks are being held.
Looking up the objects using these id's will lead you to the source of your
problem.

Solving the problem is usually much harder, but usually a good first step is
the make sure your data reads are done with the (nolock) hint where
possible. The next step would be to use an identity column for your
clustered index. This helps to avoid physical reorganization of the table
pages during inserts and updates.



[quoted text, click to view]

AddThis Social Bookmark Button