Re: Index on a NULL-value

From: Tobias Brox <tobias(at)nordicbet(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, Tobias Brox <tobias(at)nordicbet(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Index on a NULL-value
Date: 2005-05-31 05:59:32
Message-ID: 20050531055932.GL26100@tobias.exoweb.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> CREATE INDEX b_is_null ON mock(a) WHERE b IS NULL;
>
> where a is chosen as a column that you frequently also test in
> conjunction with "b IS NULL". That is, the above index can efficiently
> handle queries like
>
> ... WHERE a = 42 AND b IS NULL ...

This is wonderful, it seems like most of our problems (probably also
regarding the "index on timestamp"-thread I started separately) can be
solved with partial indexing on expressions. No need to hide under
bedclothes anymore ;-)

--
Tobias Brox, Beijing

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Praveen Raja 2005-05-31 09:37:48 very large table
Previous Message Tom Lane 2005-05-31 05:12:46 Re: Index on a NULL-value