Yesterday was the first anniversary of this unanswered question. It still applies, to Version 16 as well as 12... if one was impolite, one might ask "What is the point of CONNECTION_PROPERTY ( 'LockCount' ) if it returns zero for a connection that is holding a schema lock that is actually blocking another connection?" :)


Here is a query run in 12.0.1.3298 that shows one schema lock exists but DB_PROPERTY ( 'LockCount' ) returns zero. The same is true for CONNECTION_PROPERTY ( 'LockCount' ).

select DB_PROPERTY ( 'LockCount' ), * from sa_locks();

DB_PROPERTY('LockCount'),conn_name,conn_id,user_id,table_type,creator,table_name,index_id,lock_class,lock_duration,lock_type,row_identifier
'0','OLTP1_update',12,'DBA','BASE','DBA','t',,'Schema','Transaction','Shared',

If there are a million locks, will the following workaround be optimized or will it be slowwwwww?

SELECT COUNT(*) FROM sa_locks();

COUNT()
1

asked 27 Oct '13, 17:56

Breck%20Carter's gravatar image

Breck Carter
27.0k444614889
accept rate: 21%

edited 28 Oct '14, 11:56

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×248

question asked: 27 Oct '13, 17:56

question was seen: 478 times

last updated: 28 Oct '14, 11:56