Skip to Main Content

Breadcrumb

May 4th

Question and Answer

Tom Kyte

Thanks for the question, Raghavendra.

Asked: July 23, 2007 - 2:49 am UTC

Last updated: July 23, 2007 - 12:42 pm UTC

Version: 10.2.0

Viewed 1000+ times

You Asked

I have a table:

create table t ( a int, b date, c varchar2(30) );

with this data in it:

insert into t values ( 1, to_date( '01-jan-2004'), 'hello' );
insert into t values ( 2, to_date( '15-jan-2004'), 'world' );

Assumption:

ROWID behaves like a table column, but is not actually stored in the table.

Question:

Where is the ROWID Stored? Is it stored with the table and acts like a hidden column?

and Tom said...


rowid is generated.

a rowid is basically:

a) file
b) block
c) slot on block
d) other object information

if you are scanning a table, you've read a block from a file and are looking at row number <N> on the block. You have a,b,c - and since you are scanning some object, you know d as well (you are scanning some object, you know the object!)


If you are given a rowid, it is like being given the address - you get the file, you get the block and you get the slot on the block - there you go - you can find that row right now.

So, the rowid is not stored in the table, the rowid is assembled from the location in the table you are currently in. A rowid is stored in an index and is used to find that row again later.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

crisp answer

Boris, May 18, 2014 - 1:42 pm UTC

Can you explain this please
"A rowid is stored in an index and is used to find that row again later. "

You said the rowid is generated and not stored anywhere

Question 2: Where the tables'row data is stored? Is it data blocks or data files?