Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: select count(*)
Hi!
I would like add that following things are same in both the databases.
init.ora parameters
optimizer parameters
data is also similar
but when I looked at explain plans they are different.
My question is basically how oracle treats a query with predicate as " 0 = 1".
Thanks and Regards,
Sarma
From: "Richard J. Goulet" <rgoulet@kanbay.com>
Reply-To: rgoulet@kanbay.com
To: <oracle-l@freelists.org>
Subject: RE: select count(*)
Date: Fri, 6 Oct 2006 11:32:22 -0400
Sarma,Before you run the statement in each instance try setting "set autotrace on". That should give you your answer.
![]()
Dick Goulet, Senior Oracle DBA45 Bartlett St Marlborough, Ma 01752, USA
Tel.: 508.573.1978 |Fax: 508.229.2019 | Cell:508.742.5795RGoulet@kanbay.com
: POWERING TRANSFORMATION
From: oracle-l-bounce@freelists.org [mailto:oracle-l-bounce@freelists.org] On Behalf Of Sarma Aryasomayajula
Sent: Friday, October 06, 2006 11:10 AM
To: oracle-l@freelists.org
Subject: select count(*)-- http://www.freelists.org/webpage/oracle-lHi!
I'm running the below query in PROD(10g R1) and ACPT(10g R2). the query returns in fraction of a second in PROD and, If I run the same query in ACPT, it's taking 30+ mins.In ProdS5UVAD@powls01 > set timin on
S5UVAD@powls01 > select count(*) from wlcbs_master.rpt_08_vew where 0=1;COUNT(*)
----------
0Elapsed: 00:00:00.07
S5UVAD@powls01 > sho userIn ACPT:N7OTHA@AOWLS01 > set timin on
N7OTHA@AOWLS01 > select count(*) from rpt_08_vew where 0=1;COUNT(*)
----------
0Elapsed: 00:31:02.271. If I apply condition "where 0 = 1" on a single table, does oracle reads
entire table then applies this condition or otherwise since this is negative
condition does it apply without reading the entire table?
2. If the same condition is applied on a view which is join of 3 big
tables(paritioned)? How does oracle executes the query?
Can any one explain the above scenarious.
Regards,Sarma
<< klogo.gif >>
![]() |
![]() |