Skip to content

Commit

Permalink
Update queries.go
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge authored Apr 12, 2024
1 parent be29d83 commit 03c5f18
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/inspect/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ sum(heap_blks_hit) / nullif(sum(heap_blks_hit) + sum(heap_blks_read),0) AS ratio
FROM pg_statio_user_tables`

const CALLS_QUERY = `SELECT
'index hit rate' AS name,
(sum(idx_blks_hit)) / nullif(sum(idx_blks_hit + idx_blks_read),0) AS ratio
FROM pg_statio_user_indexes
UNION ALL
SELECT
'table hit rate' AS name,
sum(heap_blks_hit) / nullif(sum(heap_blks_hit) + sum(heap_blks_read),0) AS ratio
FROM pg_statio_user_tables`
query,
interval '1 millisecond' * total_exec_time AS total_exec_time,
to_char((total_exec_time/sum(total_exec_time) OVER()) * 100, 'FM90D0') || '%' AS prop_exec_time,
to_char(calls, 'FM999G999G990') AS ncalls,
interval '1 millisecond' * (blk_read_time + blk_write_time) AS sync_io_time
FROM pg_stat_statements
ORDER BY calls DESC
LIMIT 10`

const INDEX_SIZE_QUERY = `SELECT c.relname AS name,
pg_size_pretty(sum(c.relpages::bigint*8192)::bigint) AS size
Expand Down

0 comments on commit 03c5f18

Please sign in to comment.