Re: Drawbacks of create index where is not null ? - Mailing list pgsql-performance

From Craig Ringer
Subject Re: Drawbacks of create index where is not null ?
Date
Msg-id 5076586B.1000306@ringerc.id.au
Whole thread Raw
In response to Drawbacks of create index where is not null ?  (Franck Routier <franck.routier@axege.com>)
Responses Re: Drawbacks of create index where is not null ?
Re: Drawbacks of create index where is not null ?
List pgsql-performance
On 10/11/2012 01:06 AM, Franck Routier wrote:
> Hi,
>
> I have pretty large tables, with columns that might never receive any
> data, or always receive data, based on the customer needs.
> The index on these columns are really big, even if the column is never
> used, so I tend to add a "where col is not null" clause on those indexes.
>
> What are the drawbacks of defining my index with a "where col is not
> null" clause ?

* You can't CLUSTER on a partial index; and

* The partial index will only be used for queries that use the condition
"WHERE col IS NOT NULL" themselves. The planner isn't super-smart about
how it matches index WHERE conditions to query WHERE conditions, so
you'll want to use exactly the same condition text where possible.

--
Craig Ringer


pgsql-performance by date:

Previous
From: Craig Ringer
Date:
Subject: Re: hash aggregation
Next
From: Scott Marlowe
Date:
Subject: Re: shared_buffers/effective_cache_size on 96GB server