![]() ![]() The logical order follows what we are expecting: When you add RowID=4, it gets inserted into slot #3 and RowID#5 is again pushed down, to slot #4. When you then add RowID=2, this needs to be between RowID #s 1 and 3, so #2 is now in slot array #1, #3 moves to slot array #2, and #5 is moved to slot array #3. You will initially see RowID=1 put into Slot #0, RowID =3 into Slot #1 and RowID=5 into slot #2. To see this changing around as the rows are inserted, just put the select statement (which I just introduced) after each of the prior insert commands and run the script to create the table and add the rows again. How inserts change the slot the row is in Remember also that the slot array is zero-based, where the first slot is slot #0. PageTest įrom these results, you can see that the rows are all on the same page, and that the slot in the slot array on that page are incrementing for the appropriate RowID value. fn_PhysLocFormatter ( %%physloc %% ) AS FROM dbo. This is just simply added to the select clause, so the query is: The second is fn_PhysLocFormatter, which converts this into a format of FileID:PageID:SlotID. The first is %%physloc%%, which returns the physical location in a hexadecimal format. To do this, we’ll utilize two undocumented system commands. Determine row’s physical locationĪt this point, let’s look at where the system reports these rows to be at. The rows are inserted so that the odd rows are inserted first, followed by the even rows. The table’s clustered key is the RowID integer column. PageTest (RowID, Col1 ) VALUES (4, REPLICATE ( 'Row04', 100 ) ) PageTest (RowID, Col1 ) VALUES (2, REPLICATE ( 'Row02', 100 ) ) PageTest (RowID, Col1 ) VALUES (5, REPLICATE ( 'Row05', 100 ) ) PageTest (RowID, Col1 ) VALUES (3, REPLICATE ( 'Row03', 100 ) ) PageTest (RowID, Col1 ) VALUES (1, REPLICATE ( 'Row01', 100 ) ) create the dbo.PageTest table CREATE TABLE dbo. if the PageTest table exists, then drop it to start all over IF OBJECT_ID ( 'dbo.PageTest', 'U' ) IS NOT NULL DROP TABLE dbo. IF DB_ID ( 'CIPageTest' ) IS NULL CREATE DATABASE CIPageTest ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |