From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Yen <dba@richyen.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: query plan with index having a btrim is different for strings of different length
Date: Wed, 10 Dec 2008 19:08:28 -0500
Message-ID: <9070.1228954108@sss.pgh.pa.us> (raw)
In-Reply-To: <129E8D79-341B-411A-83B7-E2B509A7B6E2@richyen.com>
References: <751F49DC-1142-4E9C-95C8-BC3C229B3F0B@richyen.com>
<22937.1228865243@sss.pgh.pa.us>
<E8AE9590-4E30-49C0-B11F-D7131009A095@richyen.com>
<603c8f070812101139p189cc828hef8702f37f952b6d@mail.gmail.com>
<129E8D79-341B-411A-83B7-E2B509A7B6E2@richyen.com>
Richard Yen <dba@richyen.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, dba@richyen.com, robertmhaas@gmail.com
Subject: Re: query plan with index having a btrim is different for strings of different length
In-Reply-To: <9070.1228954108@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox