Re: Strange (?) Index behavior?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Allen Landsidel <alandsidel(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Strange (?) Index behavior?
Date: 2004-11-05 21:08:56
Message-ID: 12855.1099688936@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Allen Landsidel <alandsidel(at)gmail(dot)com> writes:
> With seqscan enabled however, "AB%" will use the index, but "A%" will not.

> The estimated cost for the query is much higher without the partial
> indexes than it is with them, and the actual runtime of the query is
> definitely longer without the partial indexes.

OK. This suggests that the planner is drastically misestimating
the selectivity of the 'A%' clause, which seems odd to me since in
principle it could get that fairly well from the ANALYZE histogram.
But it could well be that you need to increase the resolution of the
histogram --- see ALTER TABLE SET STATISTICS.

Did you ever show us EXPLAIN ANALYZE results for this query?

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2004-11-05 21:17:02 Re: postgresql amd-64
Previous Message Allen Landsidel 2004-11-05 21:02:43 Re: Strange (?) Index behavior?