> For the complete documentation index, see [llms.txt](https://til.notdu.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.notdu.com/database/intro-to-database-systems/database-storage/record-ids.md).

# Record IDs

The DBMS needs a ways to keep track of individual tuples

Each tuple is assigned a unique record identifier.

-> Most common: page\_id + offset/slot

An application cannot rely on these ids to mean anything

### Postgres

ctid (page, slot): physical location of the data

![](https://2548495579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTsnKOX7xLvOtvOXY9MlI%2Fuploads%2FZhPQK2qHlDKdAGBqC1qS%2Fimage.png?alt=media\&token=a9145fa9-cd9d-41a6-816b-effc4494027f)

`Insert to the end`

`VACUUM FULL` : like a garbage collector, it go through anh reorganize all the pages

![](https://2548495579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTsnKOX7xLvOtvOXY9MlI%2Fuploads%2F2G87hqJRF4MnAASF0U5J%2Fimage.png?alt=media\&token=c50dbcde-da5c-427d-b070-8da268fd0a90)

### SQL server

`SELECT sys.fn_PhysLocFormatter (%%physloc%%) AS [`File:Page:Slot`], * FROM TEST;`

`Delete id 102:`

![](https://2548495579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTsnKOX7xLvOtvOXY9MlI%2Fuploads%2Fgp2g0VCP1wmY8tAKG8qC%2Fimage.png?alt=media\&token=872ba1d1-889b-492b-a802-341fb4f2cd96)

`Insert 104`

![](https://2548495579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTsnKOX7xLvOtvOXY9MlI%2Fuploads%2FeLdo5FZ1U6ijX6flQLUD%2Fimage.png?alt=media\&token=97bc16f4-0b34-4014-827a-671f688d75b5)

### Oracle

Has the `rowid`

![](https://2548495579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTsnKOX7xLvOtvOXY9MlI%2Fuploads%2F5WMlflidnAq10POiIsRw%2Fimage.png?alt=media\&token=b5fbc3bb-e8bf-455b-ae1d-dd8861a19174)

![](https://2548495579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTsnKOX7xLvOtvOXY9MlI%2Fuploads%2FXAQLUL9mQL4RqD8odPOl%2Fimage.png?alt=media\&token=4901f10a-3ff3-446d-a51f-8e3b279a05ae)
