This recipe helps you when you are in doubt whether some obscure table is used any more or it is left over from the past and just takes up space.
Knowing whether anybody is using a specific table
Getting ready
Make sure that you are a superuser, or at least have full rights to the table in question.
How to do it...
- To see whether a table is currently in active use (that is, whether anyone is using it while you are watching it), run the following query on the database you plan to inspect:
CREATE TEMPORARY TABLE tmp_stat_user_tables AS
SELECT * FROM pg_stat_user_tables...