* Tom Wilcox (hungrytom@googlemail.com) wrote:
> My plan now is to try increasing the shared_buffers, work_mem,
> maintenance_work_mem and apparently checkpoint_segments and see if that
> fixes it.
errrrr. work_mem and maintenance_work_mem aren't *limits*, they're
more like *targets*. The out of memory error you're getting isn't
because PG is hitting a limit you've set in postgresql.conf- it's
happening because PG is asking the OS for more memory (eg: malloc) and
getting told "sorry, no more available". To that end, you probably want
to consider *lowering* the above parameters (in particular,
maintenance_work_mem, since that's what ANALYZE uses, iirc). That will
cause PG to use less memory and/or spill things to disk instead of
trying to ask the OS for more memory than it has available.
What are those values currently set to? How much memory is in the box?
Have you looked at PG's memory usage while these queries are running?
Do you have any swap?
Thanks,
Stephen