Re: Regex query not using index - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Regex query not using index
Date
Msg-id 20080220090209.GA32127@svana.org
Whole thread Raw
In response to Re: Regex query not using index  ("Postgres User" <postgres.developer@gmail.com>)
List pgsql-general
On Wed, Feb 20, 2008 at 12:56:54AM -0800, Postgres User wrote:
> a final question: why does this syntax do a seq scan + filter:
>
> select * from tablea where fielda = fielda   -or-  select * from
> tablea where fielda in (fielda)
>
> while this syntax results in no filter, seq scan only
>
> select * from tablea where 1 = 1
>
> it seems that both where clauses should be ignored by the optimizer-
> or am i missing something

WHERE fielda = fielda will only match non-null rows...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

Attachment

pgsql-general by date:

Previous
From: "Mikko Partio"
Date:
Subject: Re: SPI-functions and transaction control
Next
From: Tino Wildenhain
Date:
Subject: Re: Regex query not using index