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

From Franck Routier
Subject Re: Drawbacks of create index where is not null ?
Date
Msg-id 507681DD.2000906@axege.com
Whole thread Raw
In response to Re: Drawbacks of create index where is not null ?  (Craig Ringer <ringerc@ringerc.id.au>)
List pgsql-performance
Le 11/10/2012 07:26, Craig Ringer a écrit :
> * 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.
>

 From my experiments, the planner seems to be smart enougth to tell that
"where col = 'myvalue' " will match with partial index "where col is not
null".
So it will use the index and not do a full tablescan. (this is on 8.4).
This is also what Scott says in his reply.
I'm not thinking of using more complex where predicat for my indexes,
just "is not null". So I think I should not be hit by this...

Thanks,
Franck


Attachment

pgsql-performance by date:

Previous
From: Sergey Konoplev
Date:
Subject: Re: hash aggregation
Next
From: Andrea Suisani
Date:
Subject: Re: Two identical systems, radically different performance