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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to check if a query is using an index ?

Re: How to check if a query is using an index ?

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: 22 Aug 2003 03:52:56 -0700
Message-ID: <1a75df45.0308220252.62fa8e78@posting.google.com>


"F.Marchioni" <fmarchioniNIENTESPAM_at_libero.it> wrote

> I'd like to know if there's a way to check if a query is -actually- using an
> index.

Look up the SQL statement called EXPLAIN PLAN in your Oracle SQL Reference Manual.

It creates an execution plan for the query - the results of which is stored in a table called PLAN_TABLE.

If you do not have a plan table, ask your DBA to create one for you, or manually find the script called utlxplan.sql in ORACLE_HOME/rdbms/admin and run that.

You can also use AUTOTRACE in SQL*Plus for this.

> I've read that Oracle is able to evaluate what's better between a full table
> scan and using an index (true?)....

Simplistically, yes. The CBO, Oracle's Cost Based Optimizer, is a lot more intelligent, given a descent chance.

--
Billy
Received on Fri Aug 22 2003 - 05:52:56 CDT

Original text of this message

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