I clip 70 raster with polygon in postgresql, the result are: out of memory, Fatal on request size of 10872

I read some solution about changing the postgresql.conf parameter but nothing work for me

Mine is ubuntuOS, 8GB RAM, the config is

#shared_buffers = 1024MB                                                     
#huge_pages = try                                                          
#temp_buffers = 512MB                 
#max_prepared_transactions = 0         
#work_mem = 64MB                       
#maintenance_work_mem = 512MB          
#autovacuum_work_mem = -1               

Any soluton for this problem?

  • 1
    Please edit your question to specify the versions of PostgreSQL and PostGIS and the application word size (32-/64-bit). You should also include information from operating system tools tracking the overall system RAM allocation and the RAM allocation to the process which is being exhausted.
    – Vince
    Nov 8, 2015 at 14:53

1 Answer 1


You uncommented the values right?

I would try something like

set work_mem='1GB';

and then rerun your query. Generally you don't want to set it that high in the config file, since you don't want all your queries using that as its for each sort.

There is a hard limit on postgis raster size, that it can never go above 65535 x 65535 (width/height) in pixels, thought aht doesn't seem to be what you are running into.

If you do set the work_mem in your postgresql.conf (make sure it's unremarked has no # sign), you want to either restart the service or run:

SELECT pg_reload_conf();

Service settings like shared_buffers do require a restart of the service.

  • the size is now 250871400, should I increase up to 2GB ?
    – kzempty
    Nov 8, 2015 at 8:16
  • 1
    The size of what? the work_mem or shared_buffers? shared_buffers isn't used much for raster unioning so probably not that important in this case. work_mem and temp_buffers are more important. temp_buffers doesn't hurt to set in config especially if you don't have a lot of people hitting the database at same time.
    – Regina Obe
    Nov 8, 2015 at 8:50
  • sorry for information. just me connect the database, and the request size is from 10872 now up to 250871400
    – kzempty
    Nov 8, 2015 at 8:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.