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: query did a full table scan even with an index

Re: query did a full table scan even with an index

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 19 Oct 2000 23:06:33 +0200
Message-ID: <972017030.18795.0.pluto.d4ee154e@news.demon.nl>

Create histograms for that index
use analyze table ... compute statistics for all indexed columns size 10

The table has 8 indexes, which is too much, and Oracle has always had difficulty optimizing tables with more than 5 indexes.

Hth,

Sybrand Bakker, Oracle DBA

"Nhuan_at_Lieu_NoSpam.org" <Nhuan_at_Lieu.org> wrote in message news:8snltv$k3b$1_at_nnrp1.deja.com...
> Hello, I have an interesting performance tuning issue in Oracle8i and
> am wonder if someone can provide some insights.
>
> Issue: A Select query did a full table scan (expecting it using the
> index scan) even with an index on the simple WHERE clause.
>
> System: NT4 & Oracle8i Enterprise Edition Release 8.1.6.0.0
>
> Select Statement:
> SELECT GL_COMPANY_NBR,... + ABOUT 30 COLUMNS
> FROM 1_MILLION_REC_TABLE
> WHERE GL_COMPANY_NBR = '415A';
>
> Query count result: 28 rows selected.
>
> What have been done before the select statement:
> 1. The table has 8 indexes, one of them was created using:
> CREATE INDEX index_name ON 1_MILLION_REC_TABLE(GL_COMPANY_NBR)
> NOLOGGING COMPUTE STATISTICS;
>
> 2. ANALYZE TABLE 1_MILLION_REC_TABLE COMPUTE STATISTICS;
>
> DATA distribution on the 1_MILLION_REC_TABLE table:
> GL_COMPANY_NBR COUNT(GL_COMPANY_NBR)
> ---------------- ---------------------
> TEST 366
> 407G 1
> 415A 28
> 415G 981796
>
> Data from SET TIMING ON & EXPLAIN PLAN:
> Elapsed: 00:01:119.20
> Execution Plan
> ---------------------------------------------------------
> 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=8514 Card=327397
> Bytes=127357433)
> 1 0 TABLE ACCESS* (FULL) OF '1_MILLION_REC_TABLE'
> (Cost=8514 :Q178000 Card=327397 Bytes=127357433)
>
>
> Statistics
> -----------------------------------------------------
> 787 recursive calls
> 69 db block gets
> 56224 consistent gets
> 56099 physical reads
> 684 redo size
> 13504 bytes sent via SQL*Net to client
> 696 bytes received via SQL*Net from client
> 3 SQL*Net roundtrips to/from client
> 21 sorts (memory)
> 0 sorts (disk)
> 28 rows processed
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Oct 19 2000 - 16:06:33 CDT

Original text of this message

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