Re: How to setup default value "0000-00-00" for "date" - Mailing list pgsql-general

From Bruce Momjian
Subject Re: How to setup default value "0000-00-00" for "date"
Date
Msg-id 200408201512.i7KFCeb10200@candle.pha.pa.us
Whole thread Raw
In response to Re: How to setup default value "0000-00-00" for "date"  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List pgsql-general
Karsten Hilbert wrote:
> > I guess you know where it ends--the index is not used for IS [NOT] NULL
> > expressions. The obvious workaround was to add DEFAULT value to
> > "processed" in form of kind of anchor (we used '-infinity')
>
> Wouldn't it have worked to add an index
>
>     ... WHERE processed IS NULL
>
> and go from there ?

Yes, you use a partial index.  The 8.0beta1 docs mention this:

   Indexes are not used for <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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: int8, primary key, seq scan
Next
From: Manfred Koizar
Date:
Subject: Re: Postgres "invalid page header"