RE: Just as a learning exercise

  • From: "Ric Van Dyke" <ric.van.dyke@xxxxxxxxxx>
  • To: <ganstadba@xxxxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 4 May 2011 09:46:14 -0500

Roger that.  That *IS* where it's useful as a place holder, but nothing
more.  The good old programming "sub", like writing a PL/SQL procedure
with just 

BEGIN
  NULL;
END;

As the code, it's there and a call to the procedure will always work,
because it does nothing! And it runs really fast too!  

But would adding a "NULL" to the top of every PL/SQL block make it run
faster? I think we can all agree that it wouldn't, and logically that is
about the same thing that adding 1=1 to your query. 

-----------------------
Ric Van Dyke
Hotsos Enterprises
Cell 248-705-0624
-----------------------
 
The 10th Hotsos Symposium 
4-8 March 2012  Start making plans now! 
 
 

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Michael McMullen
Sent: Wednesday, May 04, 2011 10:34 AM
To: oracle-l@xxxxxxxxxxxxx
Subject: RE: Just as a learning exercise

We use 1=1 a lot for on the fly report generation with different
conditions
that the user can specify, this way "and" statements can just be tacked
on
at the end and then the query run, it's all done via pl/sql.

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx]
On Behalf Of Ric Van Dyke
Sent: Wednesday, May 04, 2011 10:12 AM
To: Rui.Amaral@xxxxxxxxxxxxxxxx; rjoralist2@xxxxxxxxxxxxxxxxxxxxx;
oracle-l@xxxxxxxxxxxxx
Subject: RE: Just as a learning exercise

I'm pretty sure that 1=1 has never improved performance of a query; it's
like adding "TURE" to a statement.  Certainly since about 9 or so the
optimizer removes it as a predicate, notice the 1=1 predicate isn't
applied
at all in the plan below (yes I truncated the plan so as to fit better):


--
//www.freelists.org/webpage/oracle-l


--
//www.freelists.org/webpage/oracle-l


Other related posts: