Thread: Check if installed extension is in use

Check if installed extension is in use

From
Christian Lehmann
Date:
Hi List
I am currently building a new postgresql-13 (maybe 14, if release is
on time) cluster which will replace the currently running 9.6
instances. I don't know much about the data(bases) which are on these
clusters.

I saw that plpythonu is installed on all instances. As I understand,
the only version of plpython is version 3 and existing scripts may no
longer work with python3.

Now my question: Is it possible to see if a certain extension is in
active use? Do I have to switch on statement-logs to see it?
Unfortunately even (some) application-owners cannot answer if I ask
them if the python is used.

I hope my question is clear enough.
Chris



Re: Check if installed extension is in use

From
Laurenz Albe
Date:
On Wed, 2021-06-30 at 16:14 +0200, Christian Lehmann wrote:
> Now my question: Is it possible to see if a certain extension is in
> active use?

BEGIN;
DROP EXTENSION plpython3u;
ROLLBACK;

If you can drop the extension, no objects depend on it.

For example, that will show if there are any PL/Python functions defined.

If you want to know if PL/Python functions are used, monitor
"pg_stat_user_functions" (after enabling "track_functions") and see if
the number of calls is growing.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com