=?KOI8-R?B?5dfHxc7JyiDzxczR18vB?= <evg.selyavka@gmail.com> writes:
> today my database crashed with out of memory
This is probably why:
> work_mem = 2GB
Don't do that. It's especially silly to have this setting higher than
maintenance_work_mem --- should be the other way 'round.
I would also question your setting of shared_buffers. The traditional
advice is to dedicate maybe a quarter of RAM to shared_buffers, not
three-quarters.
For more info try
https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
regards, tom lane