| From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> | 
|---|---|
| To: | Postgres User <postgres(dot)developer(at)gmail(dot)com> | 
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: Regex query not using index | 
| Date: | 2008-02-20 09:02:09 | 
| Message-ID: | 20080220090209.GA32127@svana.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | 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(at)svana(dot)org>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mikko Partio | 2008-02-20 09:02:55 | Re: SPI-functions and transaction control | 
| Previous Message | Postgres User | 2008-02-20 08:56:54 | Re: Regex query not using index |