Re: Delete fails with out of memory - Mailing list pgsql-general

From Simon Riggs
Subject Re: Delete fails with out of memory
Date
Msg-id 1255893221.30088.10770.camel@ebony
Whole thread Raw
In response to Delete fails with out of memory  (yuliada <yuliada@gmail.com>)
List pgsql-general
On Sat, 2009-10-17 at 20:02 -0700, yuliada wrote:

> I have a large database and I'm trying to execute delete on a table which
> has some related tables. The query fails with following error:
> ERROR:  out of memory
> DETAIL:  Failed on request of size 1048576.
>
> I'm new to postgresql and I'm currently trying to figure out what to do by
> myself. I've played with some config memory parameters, but with no luck by
> now. It would be great if somebody could tell me how to solve it or give any
> clues on why it happens or in which direction to search.
>
> Here is the log:
>
>     AfterTriggerEvents: 872443512 total in 839 blocks; 9152 free (5 chunks);
> 872434360 used

The RI triggers are causing the out of memory situation, it would
appear. You'll need to either
* use Truncate
* run a series of smaller transactions to delete the rows
* insert the rows you wish to keep into a new table then add RI to it,
drop the old, rename the new.

--
 Simon Riggs           www.2ndQuadrant.com


pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: How ad an increasing index to a query result?
Next
From: Gerhard Wiesinger
Date:
Subject: Function returning 2 columns evaluated twice when both columns are needed