pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Burbridge <Daniel.Burbridge@publishingtechnology.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Prepared statements slow in 9.2 still (bad query plan)
Date: Sun, 28 Oct 2012 11:06:21 -0400
Message-ID: <12200.1351436781@sss.pgh.pa.us> (raw)
In-Reply-To: <CA9A03D82318FE41825E250D9880D959B3BFD5@maple.VISTACOMP.COM>
References: <CA9A03D82318FE41825E250D9880D959B3BFD5@maple.VISTACOMP.COM>

Daniel Burbridge <Daniel.Burbridge@publishingtechnology.com> writes:
> I have a problem with prepared statements choosing a bad query plan - I was hoping that 9.2 would have eradicated the problem :(

9.2 will only pick the "right" plan if that plan's estimated cost is a
good bit cheaper than the "wrong" parameterized plan.  In this case,
not only is there not a lot of difference, but the difference is in the
wrong direction.  You need to fix that --- perhaps increasing stats
targets would help?

A more radical question is whether you have a well-chosen set of indexes
in the first place.  These two seem a bit odd, and certainly not
terribly well matched to this query.

			regards, tom lane




view thread (4+ messages)  latest in thread

Message-ID: <12200.1351436781@sss.pgh.pa.us>
Permalink:  ../12200.1351436781@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12200.1351436781@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, Daniel.Burbridge@publishingtechnology.com
  Subject: Re: Prepared statements slow in 9.2 still (bad query plan)
  In-Reply-To: <12200.1351436781@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