Created
March 18, 2024 10:35
-
-
Save rodo/4d6c3d753c0566286408b99484cb0276 to your computer and use it in GitHub Desktop.
Follow the user objects stats in postgresql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- first create a schema to store your new table | |
| CREATE SCHEMA dba; | |
| -- create the table | |
| CREATE TABLE dba.log_stat (LIKE pg_stat_user_tables); | |
| --- add a column to timestamp the figures | |
| ALTER TABLE dba.log_stat ADD COLUMN eventtime timestamp with time zone default now(); | |
| --- last action insert the stats in the table | |
| INSERT INTO dba.log_stat SELECT * FROM pg_stat_user_tables; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment