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: Do I need an Index?

Re: Do I need an Index?

From: <sybrandb_at_yahoo.com>
Date: 11 Aug 2005 00:43:33 -0700
Message-ID: <1123746213.419229.252700@g43g2000cwa.googlegroups.com>


1200 records out of 3500 --- > full table scan, as full table scan will be cheaper compared to using index.
If it is a web page (ie not PL/SQL, not a batch function), and the end-user definitely doesn't want to see all 1200 records (why he is asking such large resultset beats me), you would need the (generic) hint /*+ FIRST_ROWS */. In that case the index will be used. You may need to make sure the user is running in first_rows mode by issuing
alter session set optimizer_mode = first_rows in an after-logon trigger,
or change the init.ora parameter optimizer_goal to first_rows (this change will be instance wide, so beware). You may also need to verify the optimizer_index_cost_adj and optimizer_index_caching. The defaults favor full table scan. Set them to 40 and 95 respectively. Can be changed on instance, system and session level.

I would appreciate if you don't abbreviate my first name.

Hth

-- 
Sybrand Bakker
Senior Oracle DBA
Received on Thu Aug 11 2005 - 02:43:33 CDT

Original text of this message

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