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

Re: query plan with index having a btrim is different for strings of different length

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Yen <dba(at)richyen(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: query plan with index having a btrim is different for strings of different length
Date: 2008-12-11 00:08:28
Message-ID: 9070.1228954108@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Richard Yen <dba(at)richyen(dot)com> writes:
> Is there any way to tune this so that for the common last names, the query  
> run time doesn't jump from <1s to >300s?

Well, as near as I can tell there's factor of a couple hundred
difference between the frequencies of 'smith' and 'smithers', so
you shouldn't really expect similar runtimes for the two cases.

Having said that, I still think you should try to index both first
and last name.  Also I wonder whether the index on owner is worth
having at all.  It definitely doesn't seem worthwhile to index the
entries with owner = -1, since there are so many; so maybe you could
make it a partial index that excludes those entries, in order to prevent
the planner from trying to use it for this case.

			regards, tom lane

In response to

Responses

pgsql-performance by date

Next:From: Richard YenDate: 2008-12-11 01:44:23
Subject: Re: query plan with index having a btrim is different for strings of different length
Previous:From: Vladimir SitnikovDate: 2008-12-10 22:36:51
Subject: Re: query plan with index having a btrim is different for strings of different length

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