mutley1
MIS
- Jul 24, 2003
- 909
Hi guys,
Sorry if I am sounding thick here, but the brain has died at the end of the day.
I know even a select statement will put a shared lock on a table, but I have a procedure that is causing all sorts of issues. It has a
but occasionally sits there doing nothing. There is always data to be retrieved, but I have had occasions where it sits there as runnable but locks everything else out of the AG table, even though it is a select (and not vast quantities of data). This is a problem because the AG table is replicated and this blocks updates coming from production to the table in the DB that web users get the data from (transactional replication). Looking at ALL locks and blocks, this is the lead blocker and it causes a huge backlog on other reports.
Question is, is there a difference between BEGIN / END and BEGIN / COMMIT TRAN , and any ideas what may cause the select to sit there locking and doing naff all when there is nothing blocking it? I can see the OTHER processes are trying to get LCK_M_S (or IX depending) but the waitresource is on KEY x:xxxxxxxxxxx:x which I have checked in sysobjects and it is the table being selected from in the DB as found in sysobjects. I am loathe to put a NO LOCK hint in as it may stop the other items being blocked but I would have no indication of that report hanging and rather fix the problem.
If I kill the process, things run through, but someone starts it again and it locks everything up. Failing over to the other node in the cluster and back solves the whole issue for another 3 months.
DBCC CHECKDB clear
DBCC CHECKALLOC clear
DBCC CHECKTABLE clear.......
Any help appreciated.
TIA,
M
Sorry if I am sounding thick here, but the brain has died at the end of the day.
I know even a select statement will put a shared lock on a table, but I have a procedure that is causing all sorts of issues. It has a
Code:
BEGIN
select stuff
union
select other stuff
union
select more stuff
END
Question is, is there a difference between BEGIN / END and BEGIN / COMMIT TRAN , and any ideas what may cause the select to sit there locking and doing naff all when there is nothing blocking it? I can see the OTHER processes are trying to get LCK_M_S (or IX depending) but the waitresource is on KEY x:xxxxxxxxxxx:x which I have checked in sysobjects and it is the table being selected from in the DB as found in sysobjects. I am loathe to put a NO LOCK hint in as it may stop the other items being blocked but I would have no indication of that report hanging and rather fix the problem.
If I kill the process, things run through, but someone starts it again and it locks everything up. Failing over to the other node in the cluster and back solves the whole issue for another 3 months.
DBCC CHECKDB clear
DBCC CHECKALLOC clear
DBCC CHECKTABLE clear.......
Any help appreciated.
TIA,
M