psql client memory usage

From: Tim Kane <tim(dot)kane(at)gmail(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: psql client memory usage
Date: 2013-09-06 12:06:23
Message-ID: CE4F83CF.1FED8%tim.kane@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I have a fairly simple query, running on a particularly large table. For
illustration:

echo "select * from really_big_table;" | psql my_database > /dev/null

When I monitor the memory usage of the psql session, it continually grows.
In fact, for this particularly large table ­ it grows to the point of
consuming all swap, before the OOM killer takes steps to resolve it.
Clearly, this isn't what I'd like to happen.

My settings are:
Postgresql 9.1.9
work_mem = 256MB
effective_cache_size = 12GB
shared_buffers = 6GB

I have 24GB physical ram to play with.

Regardless of these settings however, I'm surprised that psql wouldn't
release that memory as it flushes each record, but maybe I've misunderstood
how memory usage works on the client side.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2013-09-06 12:49:41 Re: psql client memory usage
Previous Message vinayak 2013-09-06 11:41:42 Re: pg_dump question (exclude schemas)