Re: Optimizer & boolean syntax - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: Optimizer & boolean syntax
Date
Msg-id 003101c291a9$525b4950$6600a8c0@internal
Whole thread Raw
In response to Re: Optimizer & boolean syntax  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Re: Optimizer & boolean syntax
List pgsql-hackers
> > Are those two syntaxes eqivalent ?
> >
> > select * from users where monitored;
> > select * from users where monitored=true;
> >
> > If the answer is yes, the optimimer probably doesn't agree with you :)
>
> That depends on the definition of equivalent.  They presumably give the
> same answer (I'm assuming monitored is a boolean), but the latter has
> something that's considered an indexable condition and I believe the
> former does not (even with enable_seqscan=off the former syntax
> appears to give a sequence scan, usually a good sign it's not considered
> indexable).

I think his point is that they _should_ be equivalent.  Surely there's
something in the optimiser that discards '=true' stuff, like 'a=a' should be
discarded?

Chris




pgsql-hackers by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: [GENERAL] Bug with sequence
Next
From: Stephan Szabo
Date:
Subject: Re: Optimizer & boolean syntax