Re: [HACKERS] Index not used on select (Is this more OR + LIKE?) - Mailing list pgsql-hackers

From Mike Mascari
Subject Re: [HACKERS] Index not used on select (Is this more OR + LIKE?)
Date
Msg-id 19990724190226.16280.rocketmail@web135.yahoomail.com
Whole thread Raw
List pgsql-hackers
Thanks Tom,

You were correct, as always.  The query was wrong. 
I apologize for wasting your time.  I needed to 
encase the chained OR clauses in parens...I'll try 
and purge that Slip.

Sorry,

Mike Mascari
mascarim@yahoo.com

--- Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Mike Mascari <mascarim@yahoo.com> writes:
> > ...  However, if an OR clause is introduced as
> below:

> I think the problem is that the OR appears at top
> level in the WHERE
> clause (assuming the above is a verbatim transcript
> of your query).
> OR groups less tightly than AND, so what this really
> means is
>     (other-conditions AND (LIKEs-for-SEQ)) OR
> (LIKEs-for-SCD)
> which is undoubtedly not what you had in mind, and
> will certainly
> produce a lot of unwanted records if the query
> manages to complete.
> Every supplies tuple matching SCD will appear joined
> to every possible
> combination of records from the other tables...In
the
> mistaken version, they get evaluated for every
> possible combination
> of joined tuples...
> 
>             regards, tom lane
> 

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: RE: [HACKERS] Re: SSL patch
Next
From: Oleg Bartunov
Date:
Subject: SELECT FOR UPDATE in function