Re: Does not use index on query using "field is null"?

From: Bjørn T Johansen <btj(at)havleik(dot)no>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Does not use index on query using "field is null"?
Date: 2010-11-10 15:21:49
Message-ID: 20101110162149.16464645@pennywise.asp-as.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 10 Nov 2010 10:00:43 -0500
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> =?ISO-8859-1?Q?Bj=F8rn?= T Johansen <btj(at)havleik(dot)no> writes:
> > I have a query that looks like this...:
> > select * from table where field is null
>
> > And when I run explain, it tells me that it uses seq scan... Is this because pg thinks that seq scan is as fast as using indexes or because using index on "is null" queries does
> > not work?
>
> What PG version? Releases before 8.3 do not think that IS NULL is an
> indexable condition.
>
> regards, tom lane
>

We are using version 8.4.x...

BTJ

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vibhor Kumar 2010-11-10 15:39:03 Re: Comments on tables
Previous Message Tom Lane 2010-11-10 15:00:43 Re: Does not use index on query using "field is null"?