Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 992231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:13:58+00:00 2026-05-16T06:13:58+00:00

For example, if I do SELECT ROWID, name from emp where age > 30;

  • 0

For example, if I do

SELECT ROWID, name from emp where age > 30;

As ROWID does not take any storage space, is it calculated every time a query like this runs?


From here,

Each table in an Oracle database
internally has a pseudocolumn named
ROWID. This pseudocolumn is not
evident when listing the structure of
a table by executing a SELECT * FROM
… statement, or a DESCRIBE …
statement using SQL*Plus, nor does the
pseudocolumn take up space in the
table
.


Taking clue from the comments,

ROWID is stored when you create an index. Suppose I have no other index than the implicit one for the primary key (emp_id). In this case, will the above query go to this implicit index? How will the ROWID calculation happen?

Please note that name and age columns are not a part of the index.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:13:59+00:00Added an answer on May 16, 2026 at 6:13 am

    “Suppose I have no other index than
    the implicit one for the primary key
    (emp_id). In this case, will the above
    query go to this implicit index? How
    will the ROWID calculation happen?”

    Firstly, the “implicit index” is a real index. If we create a primary or unique key on a table and no index exists on the key column(s) Oracle we create an index, with the same name as the constraint.

    SQL> create table t72
      2      ( emp_id number not null primary key
      3        , name varchar2(10) not null
      4        , age number(3,0) )
      5  /
    
    Table created.
    
    SQL> select constraint_name from user_constraints
      2  where table_name = 'T72'
      3  and constraint_type='P'
      4  /
    
    CONSTRAINT_NAME
    ------------------------------
    SYS_C001145039
    
    1 row selected.
    
    SQL> select index_type, uniqueness
      2  from user_indexes
      3  where index_name = 'SYS_C001145039'
      4  /
    
    INDEX_TYPE                  UNIQUENES
    --------------------------- ---------
    NORMAL                      UNIQUE
    
    1 row selected.
    
    SQL>
    

    Secondly, the query filters on the AGE column. So the optimizer would ignore any index on EMP_ID. On that case the database will do a full table scan of EMP, evaluating the value of each AGE column it retrieves. For each record where AGE < 30 it will concatenate the table’s object number, the block number, the slot number and the file number into a ROWID.

    If you want to understand more about ROWID have a play around with the DBMS_ROWID package. René Nyffenegger has a useful tutorial on his website. Find out more.


    “Suppose it was SELECT ROWID, name
    from emp where emp_id > 100;. Would
    the query fetch the ROWID from the
    emp_id index? “

    There’s one easy way to tell: experimentation. First we create an index on a table with a lot of records, and freshen the statistics:

    SQL> create unique index big_i on big_emp (empno)
      2  /
    
    Index created.
    
    SQL> exec dbms_stats.gather_table_stats(user, 'BIG_EMP', cascade=>true)
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    Then we see how Oracle tackles the query:

    SQL> explain plan for
      2      select empno, rowid from big_emp
      3      where empno > 10000;
    
    Explained.
    
    SQL> select * from table(dbms_xplan.display)
      2  /
    
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------
    Plan hash value: 3238483832
    
    ------------------------------------------------------------------------------
    | Id  | Operation            | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT     |       | 24319 |   403K|    16   (0)| 00:00:01 |
    |*  1 |  INDEX FAST FULL SCAN| BIG_I | 24319 |   403K|    16   (0)| 00:00:01 |
    ------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter("EMPNO">10000)
    
    13 rows selected.
    
    SQL>
    

    If Oracle can satisfy the query with just indexed columns it doesn’t touch the table. Clearly here it is retreiving the ROWID from the index.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example: select count(*) from my table where column1 is not null and (column1 =
For example: select name from person where id=2; I wand to know if this
We have a Union Query. Here's a basic (similar) example: SELECT a.Name, b.Info FROM
As an example: SELECT name, address, phone FROM USER; Generates the table name |
example select: select * from ( select 1 cnt, 2 sm, '55' name, 12
Example: select ename from emp where hiredate = todate('01/05/81','dd/mm/yy') and select ename from emp
For example: select * from T where T.id IN(4,78,12,45) I want the returned record
Searching for values that uses the same value Example SELECT Name, UnitPrice, Quantity, Color
i have problem using LIKE structure in DB2 : for example: select * from
I need to execute a SQL Query between two databases. Example: SELECT * from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.