Path: news.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!newsfeed.news2me.com!arclight.uoregon.edu!logbridge.uoregon.edu!news-west.eli.net!not-for-mail
Message-ID: <3DA5C68D.56CFE5F2@exesolutions.com>
From: Daniel Morgan <dmorgan@exesolutions.com>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.databases.oracle.server
Subject: Re: 1=1
References: <91884734.0210091256.32c7fe4b@posting.google.com> <TQ1p9.1814$u87.135229595@newssvr21.news.prodigy.com> <91884734.0210100915.3b64eb81@posting.google.com> <P3jp9.2851$Ev1.166997253@newssvr14.news.prodigy.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 32
Date: Thu, 10 Oct 2002 18:28:00 GMT
NNTP-Posting-Host: 156.74.250.7
X-Complaints-To: yvonne.tracy@ci.seattle.wa.us
X-Trace: news-west.eli.net 1034274480 156.74.250.7 (Thu, 10 Oct 2002 12:28:00 MDT)
NNTP-Posting-Date: Thu, 10 Oct 2002 12:28:00 MDT
Organization: City of Seattle NewsReader Service
Xref: newsfeed1.easynews.com comp.databases.oracle.server:163763
X-Received-Date: Thu, 10 Oct 2002 11:27:56 MST (news.easynews.com)

Karsten Farell wrote:

> Joel Garry wrote:
> > I was hoping that wouldn't be the answer.  But... it's the _last_
> > one...
> > [and I've seen others ending with AND 1=1) AND 1=1)]
> >
> > I just have some vague memory from years ago that it had some sort
> > of useful effect in rule-based.
> >
> > jg
> Maybe the 1=1 on the end is tacked on as a result of not selecting
> anything from a drop-down list on the UI (as the value of the default
> item). I suspect the cost-based optimizer throws away the 1=1 clauses
> anyhow (no matter where they are).
>
> You might be remembering the old tricks we used on the rule-based
> optimizer (did it really optimize anything?) to avoid index usage - eg,
> select column+0 or column||''. Perhaps they still work with CBO (unless
> it has grown so smart it knows when to ignore us).

There are times when using 1=1 makes a significant difference in the
execution plan selected by the CBO. And thus, it can dramatically improve
performance of a query.

As to why? I can't say. But I had a query once where dragging DUAL into it
provided the same improvement.

Go figure. Not doubt Howard, Jonathan, Tom, and other can. I can't.

Daniel Morgan

