Re: Optimizer & boolean syntax

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Daniele Orlandi <daniele(at)orlandi(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimizer & boolean syntax
Date: 2002-11-21 21:38:30
Message-ID: 20021121133645.O99444-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 21 Nov 2002, Daniele Orlandi wrote:

> 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).

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message scott.marlowe 2002-11-21 21:49:18 Re: performance of insert/delete/update
Previous Message Josh Berkus 2002-11-21 21:23:57 Re: performance of insert/delete/update