Last active
          August 24, 2018 19:09 
        
      - 
      
- 
        Save magnobiet/95cb0d57e5d5013afceb43af043ee41e to your computer and use it in GitHub Desktop. 
    Database
  
        
  
    
      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
    
  
  
    
  | -- PostgreSQL | |
| SELECT | |
| datname, | |
| usename, | |
| query, | |
| waiting, | |
| state, | |
| backend_start, | |
| xact_start, | |
| query_start, | |
| state_Change, | |
| client_addr || ':' || client_port AS client | |
| FROM pg_stat_activity; | |
| -- MySQL | |
| SHOW PROCESSLIST; | 
  
    
      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
    
  
  
    
  | -- PostgreSQL and MySQL | |
| SELECT version(); | 
  
    
      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
    
  
  
    
  | -- PostgreSQL | |
| SELECT | |
| schemaname, | |
| relname, | |
| n_live_tup | |
| FROM pg_stat_user_tables | |
| ORDER BY n_live_tup DESC; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment