Reducing memory usage of insert into select operations? - Mailing list pgsql-general

From Francisco Reyes
Subject Reducing memory usage of insert into select operations?
Date
Msg-id cone.1216344073.438238.29970.1000@zoraida.natserv.net
Whole thread Raw
Responses Re: Reducing memory usage of insert into select operations?
Re: Reducing memory usage of insert into select operations?
List pgsql-general
Redhat 4
postgresql 8.3.3
Memory: 12GB

While doing a couple of operations of the type
insert into <table> select from <some other table>

The OS triggered the out of memory killer (oom-killer).

After some research and trial/error I found it was the inserts.
I see one of the inserts is using up 12GB!

How can I reduce the usage?
Postgresql.conf settings.
shared_buffers = 3GB
temp_buffers = 64MB                     # min 800kB
work_mem = 256MB                        # min 64kB
maintenance_work_mem = 1GB


Reducing work_mem would help?

The table I am selecting from has a few hundred million rows.
The table I am inserting into has partitions. I am benchmarking breaking up
a large table into smaller partitions.

pgsql-general by date:

Previous
From: Klint Gore
Date:
Subject: Re: query optimization
Next
From: Bruce Momjian
Date:
Subject: Re: TODO list and "hyphen"