| From: | Simon Riggs <simon(at)2ndQuadrant(dot)com> | 
|---|---|
| To: | yuliada <yuliada(at)gmail(dot)com> | 
| Cc: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: Delete fails with out of memory | 
| Date: | 2009-10-18 19:13:41 | 
| Message-ID: | 1255893221.30088.10770.camel@ebony | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gerhard Wiesinger | 2009-10-18 20:05:29 | Function returning 2 columns evaluated twice when both columns are needed | 
| Previous Message | Raymond O'Donnell | 2009-10-18 16:00:55 | Re: How ad an increasing index to a query result? |