Skip site navigation (1) Skip section navigation (2)

pgsql: Improve the performance of LIKE/regex estimation in non-C

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve the performance of LIKE/regex estimation in non-C
Date: 2007-11-07 22:37:24
Message-ID: 20071107223724.D192A754229@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Improve the performance of LIKE/regex estimation in non-C locales, by making
make_greater_string() try harder to generate a string that's actually greater
than its input string.  Before we just assumed that making a string that was
memcmp-greater was enough, but it is easy to generate examples where this is
not so when the locale is not C.  Instead, loop until the relevant comparison
function agrees that the generated string is greater than the input.

Unfortunately this is probably not enough to guarantee that the generated
string is greater than all extensions of the input, so we cannot relax the
restriction to C locale for the LIKE/regex index optimization.  But it should
at least improve the odds of getting a useful selectivity estimate in
prefix_selectivity().  Per example from Guillaume Smet.

Backpatch to 8.1, mainly because that's what the complainant is using...

Modified Files:
--------------
    pgsql/src/backend/optimizer/path:
        indxpath.c (r1.222 -> r1.223)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/indxpath.c?r1=1.222&r2=1.223)
    pgsql/src/backend/utils/adt:
        selfuncs.c (r1.237 -> r1.238)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/selfuncs.c?r1=1.237&r2=1.238)
    pgsql/src/include/utils:
        selfuncs.h (r1.40 -> r1.41)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/selfuncs.h?r1=1.40&r2=1.41)

pgsql-committers by date

Next:From: Tom LaneDate: 2007-11-07 22:37:33
Subject: pgsql: Improve the performance of LIKE/regex estimation in non-C
Previous:From: Tom LaneDate: 2007-11-07 21:00:44
Subject: pgsql: Fix patternsel() and callers to do the right thing for NOT LIKE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group