Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will a row always have same value for %%physloc%% in SQL server?

Tags:

sql-server

I have been exploring the practical uses of the %%physloc%% pseudo-column as a row-identifier. Unfortunately, I have been having trouble finding official documentation on %%physloc%%. I need to know whether this value can ever change.

I have done a bit of testing and it seems pretty static. Even if I create a backup of my database and restore on a different server, the %%physloc%% of each row stays the same.

Can anyone please explain whether this is reliable and/or provide links to documentation? Much appreciated.

like image 710
Mr Anderson Avatar asked Aug 17 '16 19:08

Mr Anderson


People also ask

What is Physloc in SQL?

The Virtual %%physloc%% gives us the physical row location in a binary format. Using the builtin SQL function fn_physlocFormatter, we can format this binary to string and this string in file_id:page_id:slot_id format.

Which contain information about physical location of row?

In Oracle, there is a pseudo column for each row called ROWID which reveals the physical address of a row in the database file. This column can be used to identify a single row even when a row doesn't have a key.


1 Answers

It can change for any reason that moves rows: Rebuilds, shrink, page splits, reorganize, etc.

SQL Server does not provide a row ID.

like image 120
usr Avatar answered Nov 15 '22 08:11

usr