Re: Partial index with regexp not working

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>, Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Partial index with regexp not working
Date: 2007-09-11 14:16:37
Message-ID: 27812.1189520197@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton <dev(at)archonet(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Franz.Rasper 2007-09-11 14:17:35 Re: [SPAM] Re: Hardware recommendation: which is best
Previous Message Ron Johnson 2007-09-11 13:36:53 Re: Hardware recommendation: which is best