Re: Partial index with regexp not working - Mailing list pgsql-general

From Tom Lane
Subject Re: Partial index with regexp not working
Date
Msg-id 27812.1189520197@sss.pgh.pa.us
Whole thread Raw
In response to Re: Partial index with regexp not working  (Richard Huxton <dev@archonet.com>)
Responses Re: Partial index with regexp not working
List pgsql-general
Richard Huxton <dev@archonet.com> writes:
> The planner isn't smart enough to figure out which queries can use this
> index by examining them, it just looks for (NOT paid) in the WHERE
> clause and if it doesn't find it, ignores the index.

Well, it's a little bit brighter than that: it has some smarts about
btree-indexable comparisons and about null-testing.  For instance, it
can figure out that "x > 3" implies "x > 0", and so a query WHERE x > 3
could use a partial index WHERE x > 0.  Also, assuming that the >
operator is strict, it would recognize that WHERE x IS NOT NULL is
implied.

But there's certainly not anything in there that can make inferences
about regex matches.

            regards, tom lane

pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Hardware recommendation: which is best
Next
From: Franz.Rasper@izb.de
Date:
Subject: Re: [SPAM] Re: Hardware recommendation: which is best