Postgres tools
Where the memory goes, and where the query time went.
Two questions, both answerable with arithmetic that almost nobody does. work_mem is allocated per sort or hash node rather than per connection, so a query with three sorts takes it three times and a server sized on connections alone has a margin that does not exist. And in an EXPLAIN plan the time printed on a node is per loop, so a node showing under a millisecond across two thousand loops is where the query actually went.
Free, with no sign-up. Every one runs entirely in your browser: nothing you paste is uploaded, and there is no server to send it to.
Postgres Connection Pool Calculator
work_mem is per sort, not per connection
Size a Postgres connection pool against real memory. work_mem is charged per sort node rather than per connection, which is the term that causes OOM.
Postgres EXPLAIN Plan Reader
Node times are per loop
Read a Postgres EXPLAIN plan and find where the time went. Node times are per loop, so this multiplies them out and names the bad estimates.