Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will rowid be reused?

Tags:

database

rowid

In database, such as Informix, DB2, Oracle etc, will the rowid be reused pls?

like image 765
Xiaowei Avatar asked Mar 24 '09 06:03

Xiaowei


People also ask

Can Rowid be duplicate?

There are two scenarios in which duplicate rowids can occur. If you use an external table to unload a table and specify "format 'internal' compress true", NPS includes the rowids in the output. If you later reload that external table, the original rowids are preserved and brought back in.

Can Rowid be duplicate in Oracle?

rowids are unique within a table - period. We reuse them over time - absolutely. So if you delete from emp1, you are absolutely going to get "duplicates". We have to assume you do delete since - well - this is an after delete trigger..

Is Rowid unique?

Usually, a rowid value uniquely identifies a row in the database. However, rows in different tables that are stored together in the same cluster can have the same rowid.

Is it safe to use Rowid?

It would not be safe if you intended to use the ROWID a long period of time after you SELECT it-- for example, if you allow users to edit data locally and then synchronize with the master database some arbitrary length of time later.


2 Answers

The RowID are physical location of the data stored on the disk. They are unique for a table. As such they can repeat. If the new record gets stored in the same place (deleting the older one), then rowids would be same (reused).

See this article for details on what rowid consists of in oracle http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns008.htm

like image 166
Dheer Avatar answered Sep 24 '22 20:09

Dheer


It can be reused:

If you delete a row, then Oracle may reassign its rowid to a new row inserted later.

(See this)

like image 45
Anton Gogolev Avatar answered Sep 20 '22 20:09

Anton Gogolev