Re: How to setup default value "0000-00-00" for "date"

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: How to setup default value "0000-00-00" for "date"
Дата
Msg-id 200408201512.i7KFCeb10200@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: How to setup default value "0000-00-00" for "date"  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: int8, primary key, seq scan
Следующее
От: Manfred Koizar
Дата:
Сообщение: Re: Postgres "invalid page header"