pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Allen Landsidel <alandsidel@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Strange (?) Index behavior?
Date: Fri, 05 Nov 2004 16:08:56 -0500
Message-ID: <12855.1099688936@sss.pgh.pa.us> (raw)
In-Reply-To: <88f1825a0411051236497f6bbf@mail.gmail.com>
References: <88f1825a041105063955367088@mail.gmail.com>
	<20041105175159.GB8855@wolff.to>
	<88f1825a041105095631064cb0@mail.gmail.com>
	<10898.1099684660@sss.pgh.pa.us>
	<88f1825a0411051236497f6bbf@mail.gmail.com>

Allen Landsidel <alandsidel@gmail.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



view thread (27+ messages)  latest in thread

Message-ID: <12855.1099688936@sss.pgh.pa.us>
Permalink:  ../12855.1099688936@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12855.1099688936@sss.pgh.pa.us

 · 

reply

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, alandsidel@gmail.com
  Subject: Re: Strange (?) Index behavior?
  In-Reply-To: <12855.1099688936@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