Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Querying index values

Re: Querying index values

From: Jurij Modic <jmodic_at_src.si>
Date: 1998/10/21
Message-ID: <362e3cf4.2461391@news.siol.net>#1/1

On Wed, 21 Oct 1998 11:08:21 +0100, "Alan D. Mills" <alanmNOSPAM_at_uk.europe.mcd.mot.com> wrote:

>I understand that if you initiate a query and Oracle can get all it needs
>from using a suitable index it will do so and not have to hit the actual
>table itself at all. A good tuning technique this one.
>
>I'm not sure you can actually pull the ROWID of the record from the index
>though. Unless anyone knows different?

Sure you can get ROWID of the table record from the index, without touching the actual table. Indexes store indexed columns data together with the rowids of the coresponding table rows and this is what you can get from index. Here is an example:

SQL> connect scott/tiger
Connected.
SQL> set autotrace on explain
SQL> select empno, rowid from scott.emp where empno=7902;

    EMPNO ROWID

--------- ------------------
     7902 00000026.000C.0002


Execution Plan


   0 SELECT STATEMENT Optimizer=CHOOSE    1 0 INDEX (UNIQUE SCAN) OF 'PK_EMP' (UNIQUE) As you can see from the execution plan the empno end the coresponding ROWID were pulled directly from the index, without even touching the table.

>--
>Alan D. Mills

HTH,
Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Wed Oct 21 1998 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US