Re: Using index for IS NULL query

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Vladimir Sitnikov" <sitnikov(dot)vladimir(at)gmail(dot)com>
Cc: "Tomas Vondra" <tv(at)fuzzy(dot)cz>, Andrus <kobruleht2(at)hot(dot)ee>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Using index for IS NULL query
Date: 2008-11-11 23:34:42
Message-ID: dcc563d10811111534x3957273aw8365cb497cc0c91c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Nov 11, 2008 at 4:00 PM, Vladimir Sitnikov
<sitnikov(dot)vladimir(at)gmail(dot)com> wrote:
>
>> Yes, NULL values are not stored in the index, but you may create
>> functional index on
>
> Are you sure NULL values are not stored? btree, gist and bitmap index and
> search for NULL values.

It's not that they're not stored, it's that before 8.3 pg didn't know
how to compare to them I believe. The standard trick was to create a
partial index with "where x is null" on the table / column. 8.3 knows
how to compare them and doesn't need the partial index.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2008-11-12 02:34:50 Re: Oddity with view (now with test case)
Previous Message Vladimir Sitnikov 2008-11-11 23:00:13 Re: Using index for IS NULL query