]> granicus.if.org Git - postgresql/commit
> >> My question is whether postgres can index null values, and if not, do I
authorBruce Momjian <bruce@momjian.us>
Tue, 20 Apr 2004 01:00:26 +0000 (01:00 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 20 Apr 2004 01:00:26 +0000 (01:00 +0000)
commit6ef77149f7ed29d65096b126d9b062dc110b5b74
tree32e2691cfecb4b5b8dca74cfa70a0b16a7f31905
parent6949fc0269e0686bb3dd1d2b0d73a653f843705b
> >> My question is whether postgres can index null values, and if not, do I
> >> have to accept a full table scan when locating records.
> >
> > It indexes them, but "is null" is not an indexable operator, so you
> > can't directly solve the above with a 3-column index.  What you can do
> > instead is use a partial index, for instance
> >
> > create index i on CUSTOMER.WCCustOrderStatusLog (WCOrderStatusID)
> > where Acknowledged is null and Processing is null;
>
> That's a very nifty trick and exactly the sort of answer I was after!

Add CREATE INDEX doc mention of using partial indexes for IS NULL
indexing;  idea from Tom.
doc/src/sgml/ref/create_index.sgml