Re: getting around 'out of memory' errors

From: Rajarshi Guha <rguha(at)indiana(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: getting around 'out of memory' errors
Date: 2006-08-24 17:59:36
Message-ID: 1156442376.7455.75.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2006-08-24 at 10:50 -0400, Tom Lane wrote:
> Rajarshi Guha <rguha(at)indiana(dot)edu> writes:
> > I have a table, A with 15 fields, out of which I am interested in 2
> > fields, a and b. The table has 8,000,000 rows
>
> > I have another table, B, which has 3 fields a, c, and d. The field a
> > references field a in table A. Table B is empty at this point.
>
> > I tried to do an insert using the following command:
> > insert into B (a,c,d) select a, f1(b), f2(b) from A;
>
> I think you are getting burnt by the list of pending trigger actions
> to check the foreign-key references in B. Might be easiest to drop the
> foreign key constraint, fill table B, re-add the constraint. I forget
> how smart 7.4 is about adding FK constraints exactly, but it shouldn't
> run out of memory anyway.

Thanks for the pointer. I've dropped the constraint and am now running
the INSERT.

However when I look at the output of top, I'm seeing that the %MEM value
is continuously increasing and I'm worried that I'm going to hit the
same problem in a few hours.

One thing I did not mention previously is that table A has some
constraints on some fields (notably field b is specified to be NOT
NULL).

My understanding is that these constraints would not matter since I am
simply performing a SELECT - is this a correct assumption? Or should I
temporarily drop those constraints as well?

Thanks,

-------------------------------------------------------------------
Rajarshi Guha <rguha(at)indiana(dot)edu>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Q: What's yellow, linear, normed and complete?
A: A Bananach space.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karen Hill 2006-08-24 18:03:25 SQL:2003 Window Functions for postgresql 8.3?
Previous Message Michael Fuhr 2006-08-24 17:37:10 Re: Large database design advice