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
    
  
  
    
  | -- table + index sizes | |
| SELECT | |
| table_name, | |
| pg_size_pretty(table_size) AS table_size, | |
| pg_size_pretty(indexes_size) AS indexes_size, | |
| pg_size_pretty(total_size) AS total_size | |
| FROM ( | |
| SELECT | |
| table_name, | |
| pg_table_size(table_name) AS table_size, | 
  
    
      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
    
  
  
    
  | SELECT | |
| pg_stat_statements.query as query, | |
| round(pg_stat_statements.total_exec_time::numeric, 2) AS total_time, | |
| pg_stat_statements.calls, | |
| round(pg_stat_statements.mean_exec_time::numeric, 2) AS mean, | |
| round((100 * pg_stat_statements.total_exec_time / | |
| sum(pg_stat_statements.total_exec_time::numeric) OVER ())::numeric, 2) AS percentage_cpu, | |
| round((100 * pg_stat_statements.calls / | |
| sum(pg_stat_statements.calls::numeric) OVER ())::numeric, 2) AS percentage_calls, | |
| pg_user.usename as username, | 
  
    
      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
    
  
  
    
  | explain (analyze, buffers) | |
| SELECT | |
| pg_get_userbyid(userid) as user, | |
| pg_database.datname, | |
| pg_stat_statements.queryid, | |
| pg_stat_statements.calls as calls_total, | |
| pg_stat_statements.total_exec_time / 1000.0 as seconds_total, | |
| pg_stat_statements.rows as rows_total, | |
| pg_stat_statements.blk_read_time / 1000.0 as block_read_seconds_total, | |
| pg_stat_statements.blk_write_time / 1000.0 as block_write_seconds_total | 
OlderNewer