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

Re: Prepared statements and suboptimal plans

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Royce Ausburn <esapersona(at)royce(dot)id(dot)au>
Cc: pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Prepared statements and suboptimal plans
Date: 2011-09-21 16:39:35
Message-ID: CAHyXU0wgAVccv_NX7y0xekV3rPtm8ithNb4xYHYQGjA7oWF7qQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
On Tue, Sep 20, 2011 at 5:44 PM, Royce Ausburn <esapersona(at)royce(dot)id(dot)au> wrote:
> Hi all,
> It looks like I've been hit with this well known issue.  I have
> a complicated query that is intended to run every few minutes, I'm using
> JDBC's Connection.prepareStatement() mostly for nice parameterisation, but
> postgres produces a suboptimal plan due to its lack of information when the
> statement is prepared.

Postgres has gotten incrementally smarter about this, but at the end
of the day it's just working under what the jdbc driver is telling it
what to do.  One thing you can do is disable sever-side prepared
statements with the prepareThreshold=0 decoration to the jdbc url give
that a whirl and see how it turns out.

merlin

In response to

pgsql-performance by date

Next:From: Royce AusburnDate: 2011-09-21 17:08:04
Subject: Re: Prepared statements and suboptimal plans
Previous:From: Shaun ThomasDate: 2011-09-21 16:30:07
Subject: Re: REINDEX not working for wastedspace

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