Re: [HACKERS] Re: [GENERAL] indexed regex select optimisation missing?

Charles Tassell <ctassell@isn.net>

From: Charles Tassell <ctassell@isn.net>
To: Tom Lane <tgl@sss.pgh.pa.us>, "Ross J. Reedstrom" <reedstrm@wallace.ece.rice.edu>
Cc: Stuart Woolford <stuartw@newmail.net>, pgsql-general@postgreSQL.org, Lamar Owen <lamar.owen@wgcr.org>, hackers@postgreSQL.org
Date: 1999-11-06T21:13:03Z
Lists: pgsql-hackers, pgsql-general
I don't know much about the backend stuff, but wouldn't it reduce the 
amount of records you go through to do a search for FO. and then do a 
another check on each returned record to check that the last character 
matches?  More checks, but fewer total records.

Anyway, just a thought.

At 12:46 PM 11/5/99, Tom Lane wrote:
>[snip]
>
>  Basically, given that we know the LIKE or regex
>pattern can only match values beginning with FOO, we want to generate
>string comparisons that select out the range of values that begin with
>FOO (or, at worst, a slightly larger range).  In USASCII locale it's not
>hard: you can do
>         field >= 'FOO' AND field < 'FOP'
>but it's not immediately obvious how to make this idea work reliably
>in the presence of odd collation orders or multibyte characters...
>
>BTW: the \377 hack is actually wrong for USASCII too, since it'll
>exclude a data value like 'FOO\377x' which should be included.
>
>                         regards, tom lane
>
>************