This file contains 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
-- Generates a CSV export of all user-logged activities. | |
-- Adjust Company ID and activity time as needed. | |
-- If running against a follower DB, selecting into a temporary | |
-- table won't work. Instead, remove all the newlines to fit | |
-- the entire query into one line, and use it directly in the | |
-- \copy command, e.g.: | |
-- | |
-- \copy (WITH entity_types ... SELECT * FROM tmp_results_1) TO 'filename.csv' WITH CSV HEADER |
This file contains 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
SELECT | |
pg_locks.locktype, | |
pg_locks.mode, | |
pg_locks.granted, | |
pg_locks.pid, | |
pg_class.relname, | |
now() - pg_stat_activity.query_start "query_age", | |
now() - pg_stat_activity.xact_start "xact_age", | |
pg_stat_activity.query | |
FROM |