Re: Check memory consumption of postgresql query

From: Matheus de Oliveira <matioli(dot)matheus(at)gmail(dot)com>
To: Phan Công Minh <cphan(at)hsr(dot)ch>
Cc: Clinton Adams <clinton(dot)adams(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Check memory consumption of postgresql query
Date: 2014-05-12 16:38:00
Message-ID: CAJghg4+1mcK1KdunxZHYbL2hQgDz-C2XohKZPbBnQVCO_+oGig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, May 12, 2014 at 4:02 AM, Phan Công Minh <cphan(at)hsr(dot)ch> wrote:

> Thank you for your response. I check the article (
> http://www.depesz.com/2012/06/09/how-much-ram-is-postgresql-using/) and
> it seems to work with general process as well.
> However does it have anyway to calculate the memory used by single query,
> not the whole postgresql process?
>

You can check only the /proc/<pid>/ for the backend you are interested in.
Also, an EXPLAIN ANALYZE of your qurey will show memory used by some
operations (like sort, hash, etc.), those are limited by the work_mem
parameter, so if you are working on benchmarks, you may want to tune that
properly.

Regards,
--
Matheus de Oliveira
Analista de Banco de Dados
Dextra Sistemas - MPS.Br nível F!
www.dextra.com.br/postgres

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Michael Stone 2014-05-13 14:19:13 Re: Specifications for a new server
Previous Message Jeff Janes 2014-05-12 16:02:12 Re: 9.2.4 vs 9.3.0 query planning (sort merge join vs hash join)