[OSM-dev] Speeding up Osm2pgsql through parallelization?

Hartmut Holzgraefe hartmut.holzgraefe at gmail.com
Sat Sep 17 17:53:10 BST 2011


On 09/17/2011 06:43 PM, Kai Krueger wrote:
>> * start with low default work_mem and maintenance_work_mem settings
>> and raise them on a per statement level, so making the appropriate
>> buffer for a given operation (work_mem for ORDER BY,
>> maintenance_work_mem for CREATE INDEX) as large as possible and
>> then shrinking it back to its default size afterwards
>
> Is it possible to adjust work_mem and maintanance_work_mem at run time?

yes, see e.g.:

http://www.depesz.com/index.php/2011/07/03/understanding-postgresql-conf-work_mem/

   [...]
   What has to be noted though, is that you can change work_mem using
   normal sql query – and it will be changed for this particular session
   only.

   So, it might make sense to set work_mem in postgresql.conf to
   relatively low value (1-10MB), and then, find out which queries would
   use more, and change the application to issue

     set work_mem = '100MB'

   before running them, and

     reset work_mem

   afterwards.
   [...]

-- 
hartmut



More information about the dev mailing list