Re: DELETE takes too much memory

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Kouber Saparev <kouber(at)gmail(dot)com>
Cc: postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: DELETE takes too much memory
Date: 2016-07-06 16:12:02
Message-ID: CAHyXU0zm-auMa07Dixu97-6fMrcDCCG2aPbA9yM6E7pab=Ffww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Jul 4, 2016 at 11:35 AM, Kouber Saparev <kouber(at)gmail(dot)com> wrote:
> I tried to DELETE about 7 million rows at once, and the query went up to 15%
> of the RAM (120 GB in total), which pushed some indexes out and the server
> load went up to 250, so I had to kill the query.
>
> The involved table does not have neither foreign keys referring to other
> tables, nor other tables refer to it. The size of the table itself is 19 GB
> (15% of 120 GB). So why the DELETE tried to put the entire table in memory,
> or what did it do to take so much memory?
>
> I am using 9.4.5.

How did you measure memory usage exactly? In particular, memory
consumption from the pid attached to the query or generalized to the
server? Is this linux and if so what memory metric did you use? What
kinds of indexes are on this table (in particular, gin/gist?)?

merlin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message trafdev 2016-07-06 16:46:39 Re: less than 2 sec for response - possible?
Previous Message Torsten Zuehlsdorff 2016-07-06 15:27:29 Re: less than 2 sec for response - possible?