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

Re: Plan invalidation vs. unnamed prepared statements

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org, pgsql-jdbc(at)postgreSQL(dot)org
Subject: Re: Plan invalidation vs. unnamed prepared statements
Date: 2007-03-06 23:23:58
Message-ID: 12575.1173223438@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-jdbc
"Simon Riggs" <simon(at)2ndquadrant(dot)com> writes:
> On Tue, 2007-03-06 at 12:22 -0500, Tom Lane wrote:
>> A. Just accept the extra overhead, thereby preserving the current
>> behavior of unnamed statements, and gaining the benefit that plan
>> invalidation will work correctly in the few cases where an unnamed
>> statement's plan lasts long enough to need replanning.

> With connection pooling, multiple sessions will execute each statement.
> If we check the cache each time this does seem more expensive for each
> individual session, but we should gain synergy from other similar
> sessions.

It seems fairly unlikely to me that client code would try to share an
unnamed statement across multiple application threads; the entire point
is that it's for one-off queries.

Or did you miss the point that the plan cache is local per-backend?

> ISTM there will be some cases where the current behaviour will not be
> maintained if we implement A exactly. One thing I've not seen mentioned
> is the effect of constants on various plans. 

There is none.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Gregory StarkDate: 2007-03-06 23:36:39
Subject: Re: GIST and TOAST
Previous:From: Simon RiggsDate: 2007-03-06 23:04:21
Subject: Re: Plan invalidation vs. unnamed prepared statements

pgsql-jdbc by date

Next:From: Mike ClementsDate: 2007-03-06 23:35:10
Subject: Re: Fetching generated keys
Previous:From: Simon RiggsDate: 2007-03-06 23:04:21
Subject: Re: Plan invalidation vs. unnamed prepared statements

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