If I pg_restore a DB and don't ANALYSE before a pl/pgsql trigger activates 
then that trigger's going to be planned based on the default stats forever 
isn't it?

-- 
  Richard Huxton
  Archonet Ltd

Fri, 19 Mar 2004 10:22:04 +0000
Richard Huxton <dev@archonet.com>
Question on restoring and compiled plans
Richard Huxton <dev@archonet.com> writes:
> If I pg_restore a DB and don't ANALYSE before a pl/pgsql trigger activates 
> then that trigger's going to be planned based on the default stats forever 
> isn't it?

Only for the life of the current backend(s).

If that's still too long for you, you could do a CREATE OR REPLACE FUNCTION
that doesn't actually change anything about the trigger function; that
will force current cached plans to be thrown away.

			regards, tom lane

Fri, 19 Mar 2004 10:04:35 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Question on restoring and compiled plans 
On Friday 19 March 2004 15:04, Tom Lane wrote:
> Richard Huxton <dev@archonet.com> writes:
> > If I pg_restore a DB and don't ANALYSE before a pl/pgsql trigger
> > activates then that trigger's going to be planned based on the default
> > stats forever isn't it?
>
> Only for the life of the current backend(s).

Ah that's alright then. ANALYZE is usually the first thing I do after a 
restore anyway, but thought I'd check how important it was that I remember.

-- 
  Richard Huxton
  Archonet Ltd

Fri, 19 Mar 2004 15:28:56 +0000
Richard Huxton <dev@archonet.com>
Re: Question on restoring and compiled plans