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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL statement tuning

Re: SQL statement tuning

From: Wolfgang Breitling <breitliw_at_centrexcc.com>
Date: Wed, 28 Nov 2007 05:23:31 -0700
Message-Id: <20071128122346.A15EC7C4599@turing.freelists.org>


Are you sure the execution plan is the same? Or do you mean the explain plan is the same? I find it hard to believe that a full scan of a table of 3.1 million rows would take only milliseconds.

>Can someone shed some light on how to tune this sql statement?
>Oracle version 10.2
>
>SELECT T143.C1,C490021100,C1000000001,C200000020
>FROM aradmin.T143
>WHERE (((T143.C200000020 LIKE ('Eagle' || '%')) AND (0 = 0)) OR
>('Eagle' = ' '));
>
>Execution Plan
>----------------------------------------------------------
>Plan hash value: 1317490582
>------------------------------------------------------------------------
>| Id | Operation | Name | Rows | Bytes |
>------------------------------------------------------------------------
>| 0 | SELECT STATEMENT | | 7375 | 388K|
>| 1 | TABLE ACCESS BY INDEX ROWID| T143 | 7375 | 388K|
>|* 2 | INDEX RANGE SCAN | I143_200000020_1 | 7624 | |
>------------------------------------------------------------------------
>Predicate Information (identified by operation id):
>---------------------------------------------------
> 2 - access("T143"."C200000020" LIKE 'Eagle%')
> filter("T143"."C200000020" LIKE 'Eagle%')

[snip]

>Rows Row Source Operation
>------- ---------------------------------------------------
> 1 TABLE ACCESS FULL T143 (cr=130472 pr=126166 pw=0 time=129302 us)

[snip]

>There are 3.1 million rows for this table, the "Eagle" = " " is used
>in workflow for a specific function on a remedy application. If I
>take out the 'OR'(I figure it's always not true), the query runs in
>milliseconds, the execution plan is the same . The problem is that
>we can't take the 'OR' out. How can I solve this?

Regards

Wolfgang Breitling
Centrex Consulting Corporation
www.centrexcc.com

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Nov 28 2007 - 06:23:31 CST

Original text of this message

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