Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-21 Thread Royce Ausburn
Sorry all - this was a duplicate from another of my addresses =( Thanks to all that have helped out on both threads. On 21/09/2011, at 8:44 AM, Royce Ausburn 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

Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-21 Thread Merlin Moncure
On Tue, Sep 20, 2011 at 5:44 PM, Royce Ausburn 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 produ

Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-21 Thread Grzegorz Jaśkiewicz
one thing, in SUM() , you don't have to coalesce. Consider following example: foo=# create table bar(id serial primary key, a float); NOTICE: CREATE TABLE will create implicit sequence "bar_id_seq" for serial column "bar.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "bar_pkey

Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-20 Thread Tom Lane
Stephen Frost writes: > * Tom Lane (t...@sss.pgh.pa.us) wrote: >> really pretty simple: decide whether to use a custom (parameter-aware) >> plan or a generic (not-parameter-aware) plan. > Before I go digging into this, I was wondering, is this going to address > our current problem of not being

Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-20 Thread Stephen Frost
Tom, * Tom Lane (t...@sss.pgh.pa.us) wrote: > really pretty simple: decide whether to use a custom (parameter-aware) > plan or a generic (not-parameter-aware) plan. Before I go digging into this, I was wondering, is this going to address our current problem of not being able to use prepared que

Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-20 Thread Stephen Frost
* Royce Ausburn (royce...@inomial.com) wrote: > > Tom just mentioned that 9.1 will be able to re-plan parameterized prepared > > statements, so this issue will go away. In the mean time you can only > > really use the standard workaround of setting the prepare theshold to 0 to > > disable server

Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-20 Thread Tom Lane
Andy Lester writes: > On Sep 20, 2011, at 7:36 PM, Tom Lane wrote: >> 9.2, sorry, not 9.1. We could use some motivated people testing that >> aspect of GIT HEAD, though, since I doubt the policy for when to re-plan >> is quite ideal yet. > Is motivation and a box enough? I have motivation, but

Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-20 Thread Andy Lester
On Sep 20, 2011, at 7:36 PM, Tom Lane wrote: > 9.2, sorry, not 9.1. We could use some motivated people testing that > aspect of GIT HEAD, though, since I doubt the policy for when to re-plan > is quite ideal yet. Is motivation and a box enough? I have motivation, but not knowledge of interna

Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-20 Thread Tom Lane
Craig Ringer writes: > On 21/09/2011 7:27 AM, Royce Ausburn wrote: >> We've been worst hit by this query on an 8.3 site. Another site is >> running 8.4. Have there been improvements in this area recently? >> Upgrading to 9.0 might be viable for us. > Tom just mentioned that 9.1 will be able t

Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-20 Thread Royce Ausburn
On 21/09/2011, at 9:39 AM, Craig Ringer wrote: > On 21/09/2011 7:27 AM, Royce Ausburn 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() most

Re: [PERFORM] Prepared statements and suboptimal plans

2011-09-20 Thread Craig Ringer
On 21/09/2011 7:27 AM, Royce Ausburn 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 suboptima