> #sort_mem = 1024 # min 64, size in KB
> sort_mem = 60000
I think this might be too much. You are using 60000KB _per connection_ here
= 10GB for your maximum of 180 connections.
By comparison, I am specifiying 4096 (subject to adjustment) for a machine
with a similar spec to yours.