Re: Indexing null dates

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: johnsw(at)wardbrook(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Indexing null dates
Date: 2004-04-20 04:25:33
Message-ID: 200404200425.i3K4PX507858@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > + <literal>NULL</> values are not indexed by default.
>
> This is quite incorrect. The nulls *are* indexed (at least in btree
> indexes); the issue is whether there is any way to use the index to
> search for them. I do not think it helps anyone for the documentation
> to get this basic point wrong, even if the distinction is subtle.

OK, docs updated with:

Indexes can not be used with <literal>IS NULL</> clauses by default.
The best way to use indexes in such cases is to create a partial index
using an <literal>IS NULL</> comparison.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2004-04-20 04:41:44 Re: [OT] Tom's/Marc's spam filters?
Previous Message Joe Conway 2004-04-20 04:19:05 Re: [OT] Tom's/Marc's spam filters?