pattern-match selectivity code and lower(thing) LIKE
On Tue, 07 Aug 2001, Tom Lane wrote:
I'm on 7.1
(PostgreSQL 7.1.2 on i686-pc-linux-gnu, compiled by GCC 2.95.4)
Okay ... [ looks at code ... ] oh, I see the problem. The pattern-match
selectivity code doesn't try to deal with "lower(foo) LIKE ...":
/*
* If expression is not var op constant for
* a simple var of a real relation (no subqueries, for now),
* then punt and return a default estimate.
*/
This could probably be improved, but I don't have time to think
about it now. In the meantime you could try knocking
DEFAULT_MATCH_SEL down a little bit. (It's already been reduced to
0.005 in current sources, in fact.) See
src/backend/utils/adt/selfuncs.c.
Has this improved any since Aug. ? I tried to look in the current CVS,
but I don't know where this code would be. I did a quick find and
couldn't locate the comment shown above anywhere.
(I've returned to my original project, and tried reducing
DEFAULT_MATCH_SEL in 7.1.3 to 0.005 (it was 0.01 in the current cygwin
source); this didn't help so I'm going to use lowercase only entries
in my tables for now so I don't have to index lower(item)).
Nick
--
Part 3 MEng Cybernetics; Reading, UK http://www.nickpiper.co.uk/
Change PGP actions of mailer or fetch key see website 1024D/3ED8B27F
Choose life. Be Vegan :-) Please reduce needless cruelty + suffering !