Re: When deleting the plpgsql function, release the CachedPlan of the function - Mailing list pgsql-hackers

From Tom Lane
Subject Re: When deleting the plpgsql function, release the CachedPlan of the function
Date
Msg-id 420591.1755535115@sss.pgh.pa.us
Whole thread Raw
In response to Re: When deleting the plpgsql function, release the CachedPlan of the function  (Matthias van de Meent <boekewurm+postgres@gmail.com>)
Responses Re: When deleting the plpgsql function, release the CachedPlan of the function
List pgsql-hackers
Matthias van de Meent <boekewurm+postgres@gmail.com> writes:
> I'm trying to figure out how this patch is supposed to handle
> concurrent sessions dropping a procedure that has cached plans.

It doesn't, which is (one reason) why it's just a crude hack.

A more appropriate solution would be to make plpgsql install
a shared-cache-invalidation callback that would watch for
invalidations on pg_proc and mark relevant function trees as
deletable.  It couldn't necessarily delete them right away,
since they might be in use at the moment the inval event
arrives.  (That is, an inval might just indicate an update
not a delete.  But flushing the function tree would be OK
in either case.)

I wonder if we could make src/backend/utils/cache/funccache.c
handle this, so that SQL functions could also benefit without
duplicated logic.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Jacob Champion
Date:
Subject: Re: Proposal: Extending the PostgreSQL Protocol with Command Metadata
Next
From: Filip Janus
Date:
Subject: Re: Proposal: Adding compression of temporary files