From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to setup default value "0000-00-00" for "date" |
Date: | 2004-08-20 15:12:40 |
Message-ID: | 200408201512.i7KFCeb10200@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(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
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Amiel | 2004-08-20 15:21:46 | Re: int8, primary key, seq scan |
Previous Message | Tom Lane | 2004-08-20 14:56:01 | Re: int8, primary key, seq scan |