Re: Optimizer & boolean syntax

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Stephan Szabo" <sszabo(at)megazone23(dot)bigpanda(dot)com>, "Daniele Orlandi" <daniele(at)orlandi(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimizer & boolean syntax
Date: 2002-11-21 21:59:53
Message-ID: 003101c291a9$525b4950$6600a8c0@internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Wei Weng 2002-11-21 22:23:57 Re: performance of insert/delete/update
Previous Message scott.marlowe 2002-11-21 21:52:18 Re: [HACKERS] [GENERAL] Bug with sequence