Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ** SQL QUERY TUNING
On Fri, 17 Apr 1998 17:09:20 +0200, Jürgen Kling <jkling_at_w-4.de>
wrote:
>Who can help me to optimize the following SQL-Statement
>
>
>
>select * from table
>
>where tab_column = 1
>
> or tab_column is null
>
>
>
>Thje column TAB_COLUMN having an index, but ORACLE cant't use it. Thus
>
>Oracle do an Full Table scan.
>
>
>
>
>
>jkling_at_w-4.de
How many records are in the table? If there are very few, sometimes it is faster to perform a full table scan.
If the table has many records, then execute the following command on a SQL*Plus prompt:
ANALYZE TABLE table ESTIMATE STATISTICS;
Statistics about the table will be collected (number of rows, etc.) and accessible via the USER_TABLES view. The optimizer will take this into account when SQL statements are parsed, assuming you are using the COST-based optimizer.
Good luck,
Nuno Guerreiro Received on Fri Apr 17 1998 - 09:54:12 CDT