Re: Another seq scan instead of index question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nicholas Piper <nick(at)nickpiper(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Another seq scan instead of index question
Date: 2001-08-07 18:25:21
Message-ID: 8841.997208721@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Nicholas Piper <nick(at)nickpiper(dot)co(dot)uk> writes:
> On Tue, 07 Aug 2001, Tom Lane wrote:
>> Your real problem is the bogus selectivity estimate. What version
>> are you running? If 7.0, see contrib/likeplanning/. If 7.1, I'd
>> be interested to see what you get from

> 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.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Eric, Audet 2001-08-07 18:27:14 Problems with Blank space
Previous Message Nicholas Piper 2001-08-07 18:21:48 Re: Another seq scan instead of index question