Re: Prepared queries and ANALYZE - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Prepared queries and ANALYZE
Date
Msg-id 11727.1051505830@sss.pgh.pa.us
Whole thread Raw
In response to Prepared queries and ANALYZE  (Gavin Sherry <swm@linuxworld.com.au>)
Responses Re: Prepared queries and ANALYZE  (Sailesh Krishnamurthy <sailesh@cs.berkeley.edu>)
Re: Prepared queries and ANALYZE  (Gavin Sherry <swm@linuxworld.com.au>)
List pgsql-hackers
Gavin Sherry <swm@linuxworld.com.au> writes:
> Looking through the query preparing and stats analyze code, I noticed that
> prepared queries using an analyzed table are not replanned. I imagine that
> some users of prepared queries would not want the above behaviour, plan
> stability etc, but surely others would.
> I didn't notice any discusion of this in the list archives. Any technical
> reasons why this shouldn't happen?

Well, there are implementation reasons why it doesn't happen: there's no
infrastructure for determining which tables a prepared query depends on
nor for re-planning it if we did notice they'd changed.

But really this is a special case of the problem of "schema changed
underneath a plan", and yes it'd be nice to notice that and invalidate
the plan.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Gavin Sherry
Date:
Subject: Prepared queries and ANALYZE
Next
From: Sailesh Krishnamurthy
Date:
Subject: Re: Prepared queries and ANALYZE