Created
February 28, 2017 22:42
-
-
Save mrtrom/deb2a0b3c711ef730340f4f878ea91d6 to your computer and use it in GitHub Desktop.
PostgreSQL useful commands
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
--Check activity tracker | |
SELECT * | |
FROM pg_stat_activity | |
--Check activity tracker by query time | |
SELECT | |
(CURRENT_TIMESTAMP - query_start) as query_time | |
, * | |
-- ^^ SQL protip: separating SELECT parameters by linebreaks and putting the | |
-- comma first lets you quickly comment out single parameters | |
FROM pg_stat_activity | |
ORDER BY query_time DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment