What's physical memory and setting of work_mem?merlin
pgsql-performance by date:
Соглашаюсь с условиями обработки персональных данных