Eelke Klein <eelke@xxxxxxx> writes: > In a database of one of our customers we sometimes get out of memory > errors. Below I have copy pasted one of these very long messages. > The error doesn't always occur, when I copy paste the query and run it > manually it works. The memory map doesn't look out of the ordinary in the slightest. The only usage that amounts to anything worth noticing is > HashBatchContext: 19128368 total in 13 blocks; 747952 free (5 chunks); 18380416 used but that seems quite legitimate considering you have work_mem set to 32MB. So I don't see that Postgres is doing anything wrong or unusual here. It seems the machine actually is running out of memory. > Memory parameters are: > shared_buffers = 4GB > temp_buffers = 32MB > work_mem = 32MB > maintenance_work_mem = 256MB That shared_buffers setting seems a bit excessive for a machine with only 8GB RAM. Do you also have swap disabled on this box? If so, the OS only has 4GB to play in for all processes and disk cache combined, so it wouldn't be too hard to envision it running out of space. Perhaps watching the machine's overall RAM situation with "top" or another tool would give more insight. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general