Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy Row Locks Exist on An Completely Empty Partition in SQL Server?
    primarykey
    data
    text
    <p>I made a partitioned table with range left func. I then <strong>insert some rows into just one partition</strong>. Result:</p> <pre><code>select partition_id, partition_number, rows from sys.partitions where object_id = object_id('ptest') </code></pre> <p>result:</p> <pre><code>partition_id partition_number rows 72057594464436224 1 8000 72057594464501760 2 0 72057594464567296 3 0 72057594464632832 4 0 </code></pre> <p>then I update some rows of this table and query sys.dm_tran_locks, then <strong>I find some RID Locks on partition4</strong> like this:</p> <pre><code>select * from sys.dm_tran_locks where resource_type = 'RID' </code></pre> <p>Result like this:</p> <pre><code>Resource_type Resource_description RID 3:13:192 RID 1:153496:257 </code></pre> <p>When I use <strong>dbcc page</strong> to verify what page 3:13 contains, I get nothing:</p> <pre><code>dbcc traceon(3604) dbcc page(db, 3, 13, 3) </code></pre> <p>Result like this:</p> <pre><code>PAGE: (3:13) BUFFER: BUF @0x03E98BCC bpage = 0x5A622000 bhash = 0x00000000 bpageno = (3:13) bdbid = 11 breferences = 0 bUse1 = 38298 bstat = 0x1c0010b blog = 0x79797979 bnext = 0x00000000 PAGE HEADER: Page @0x5A622000 m_pageId = (3:13) m_headerVersion = 1 m_type = 1 m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0xa008 m_objId (AllocUnitId.idObj) = 6973 m_indexId (AllocUnitId.idInd) = 256 Metadata: AllocUnitId = 72057594494910464 Metadata: PartitionId = 72057594464501760 Metadata: IndexId = 0 Metadata: ObjectId = 1967398128 m_prevPage = (0:0) m_nextPage = (0:0) pminlen = 12 m_slotCnt = 1 m_freeCnt = 8094 m_freeData = 5867 m_reservedCnt = 0 m_lsn = (25294:376:199) m_xactReserved = 0 m_xdesId = (0:0) m_ghostRecCnt = 0 m_tornBits = -252731581 Allocation Status GAM (3:2) = ALLOCATED SGAM (3:3) = ALLOCATED PFS (3:1) = 0x60 MIXED_EXT ALLOCATED 0_PCT_FULL DIFF (3:6) = CHANGED ML (3:7) = NOT MIN_LOGGED </code></pre> <p>So, dbcc page confirms that there is nothing in page 3:13. There comes my question, <strong>why are RID locks exists on File 3:13 while nothing exists there</strong>?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload