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: Why Adding "+0" Make A Query Run Faster

Re: Why Adding "+0" Make A Query Run Faster

From: Roman Mirzaitov <rmirzaitov_at_kt.kg>
Date: Thu, 20 Jun 2002 08:59:55 +0600
Message-ID: <aergf6$91iti$1@ID-127142.news.dfncis.de>


Hi,

adding 0 to column means disabling indexes on that column in RBO environment.
That's why you got different explain plans.

Regards,

--
Roman Mirzaitov
Brainbench MVP for Oracle Administration
www.brainbench.com

"Salaam Yitbarek" <yitbsal_at_yahoo.com> wrote in message
news:77439c33.0206191141.5c91ea15_at_posting.google.com...

> I have a query as follows:
>
> select count (distinct refdate)
> from datapoint
> where vector_id in
> (select vector_id
> from ciiw_array_vector
> where array_id = :a_id)
> and version = 1;
>
> The datapoint table is partitioned on the column vector_id. The explain
plan is:
>
> SELECT STATEMENT Hint=CHOOSE
> SORT GROUP BY
> HASH JOIN
> TABLE ACCESS BY INDEX ROWID CIIW_ARRAY_VECTOR
> INDEX RANGE SCAN PK_CIIW_ARRAY_VECTOR
> PARTITION RANGE ALL
> INDEX FAST FULL SCAN PK_DATAPOINT
>
> That is, it looks at all the partitions of the DATAPOINT table.
>
> Changing the query to:
>
> select count (distinct refdate)
> from datapoint
> where vector_id in
> (select vector_id+0
> from ciiw_array_vector
> where array_id = :a_id)
> and version = 1;
>
> changes the explain plan to:
>
> SELECT STATEMENT Hint=CHOOSE
> SORT GROUP BY
> NESTED LOOPS
> TABLE ACCESS BY INDEX ROWID CIIW_ARRAY_VECTOR
> INDEX RANGE SCAN PK_CIIW_ARRAY_VECTOR
> PARTITION RANGE ITERATOR
> INDEX RANGE SCAN PK_DATAPOINT
>
> which, of course, is much more efficient.
>
> Why does the "+0" make all the difference?
>
> Salaam
Received on Wed Jun 19 2002 - 21:59:55 CDT

Original text of this message

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