Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Despite using CTEs, I found the first query quite impenetrable. Could be because I don’t spend that much time reading non-trivial SQL queries.

I’ve been mostly using the `pg_stat_statements` table (the second technique) to find out whether my workload is read or write heavy, it’s plenty good in most situations.



pg_ system tables aren’t built for direct consumption. You typically have to massage them quite a bit to measure whatever statistic you need.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: