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 -> Index is not used, though HINT specified

Index is not used, though HINT specified

From: dbdude <dbdude08_at_yahoo.com>
Date: 30 Apr 2004 14:17:39 -0700
Message-ID: <f41b54eb.0404301317.8da6a40@posting.google.com>


I have a table named "org_cols" with a index "org_cols" on a column "COL13". Table is analyzed. I am writing following query and its doing full table scan. But if I write second query, it uses index. I know here that all the values in column "COL13" is greater then zero so I am safe, but is there a way to force the query without WHERE clause to use an index.

SELECT /*+ INDEX (org_cols org_cols)*/ COUNT(*)   FROM org_cols;
Does full table scane.

SELECT COUNT(*)
  FROM org_cols
 WHERE col13> 0;
Uses the index and return result in one tenth of the time taken by previous query.

Thanks, Received on Fri Apr 30 2004 - 16:17:39 CDT

Original text of this message

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