Big insert/delete memory problems - Mailing list pgsql-general

From Kurt Overberg
Subject Big insert/delete memory problems
Date
Msg-id 3E7762BF.9090308@hotdogrecords.com
Whole thread Raw
Responses Re: Big insert/delete memory problems
Re: Big insert/delete memory problems
List pgsql-general
Hi all,  I have a kinda weird postgres sql question for everyone.  When
running the following SQL commands:


delete from xrefmembergroup where membergroupid = 2 ; select 1 as true;

insert into xrefmembergroup (membergroupid, memberid) select 2 as
membergroupid, member.id as memberid from member where  ((extract(year
from age(birthdate))) >= '17' ); select 1 as true;

...my memory usage goes nuts- allocates 20-30 Mb per time I run this.
After it finishes these commands, the memory usage does not go back
down, so after awhile, memory usage becomes a problem.   I would
estimate that the xrefmembergroup table has about 20,000-30,000 rows in
it, and I'm deleting/inserting about 5000 rows at a time with these
commands, which run VERY fast.

Here's the table definition:

     Column     |           Type           |
Modifiers
---------------+--------------------------+------------------------------------------------------------
  id            | integer                  | not null default
nextval('"xrefmembergroup_id_seq"'::text)
  membergroupid | integer                  | not null default 0
  memberid      | integer                  | not null default 0
  timestamp     | timestamp with time zone | default
"timestamp"('now'::text)
Indexes: xrefmembergroup_pkey primary key btree (id),
          membergroupid_xrefmembergroup_key btree (membergroupid),
          memberid_xrefmembergroup_key btree (memberid)


Is this an excessive delete/insert?  Am I breaking 'good form' here?
Thanks for any help!

/kurt




pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Can I write Large Objects in parallel transactions?
Next
From: "scott.marlowe"
Date:
Subject: Re: The folding of unquoted names to lower case in PostgreSQL