Re: Drawbacks of create index where is not null ?

From: Franck Routier <franck(dot)routier(at)axege(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Drawbacks of create index where is not null ?
Date: 2012-10-11 08:22:53
Message-ID: 507681DD.2000906@axege.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Andrea Suisani 2012-10-11 14:14:11 Re: Two identical systems, radically different performance
Previous Message Sergey Konoplev 2012-10-11 06:15:03 Re: hash aggregation