Re: DELETE takes too much memory

From: Kouber Saparev <kouber(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: DELETE takes too much memory
Date: 2016-07-04 17:10:09
Message-ID: CAN4RuQt5GZEbkHdPmm=j-z2uE3m3U-USWFNhVRiqYAKv5BZqhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

No. There are AFTER triggers on other tables that write to this one though.
It is an audits table, so I omitted all the foreign keys on purpose.

2016-07-04 20:04 GMT+03:00 Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>:

> Kouber Saparev 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?
>
> Are there triggers in the table? Deferred triggers in particular can
> use memory.
>
> --
> Álvaro Herrera http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Pujol Mathieu 2016-07-05 10:10:31 Re: less than 2 sec for response - possible?
Previous Message Alvaro Herrera 2016-07-04 17:04:58 Re: DELETE takes too much memory