Discussion:
Out of memory error
(too old to reply)
ow
2004-06-15 20:24:23 UTC
Permalink
pg 7.4.2 on RH 7.3

Hi,

Am getting "Out of memory error" and pgSql is getting killed when running the
following statement in psql:

insert into tableA
select * from tableB
where testdate >= '2000-01-01' and testdate <= '2002-12-31'

TableB contains about 120 million records. The insert/select affects about
30-40M.

What's happening is that pgSql gradually takes all (well, almost) physical and
swap memory and then, I think, is getting killed by the kernel.

Qs:

1) Is this normal?
2) Is there anything I can do besides adding more memory to the box?

Thanks







__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Tom Lane
2004-06-16 01:39:23 UTC
Permalink
Post by ow
insert into tableA
select * from tableB
where testdate >= '2000-01-01' and testdate <= '2002-12-31'
What's happening is that pgSql gradually takes all (well, almost) physical and
swap memory and then, I think, is getting killed by the kernel.
1) Is this normal?
No.

Perhaps you have a bunch of triggers (including foreign-key checks) on
tableA? If so it'd probably be best to drop them temporarily.
The only reason I can think for this to eat memory is if the
pending-trigger-events queue is growing ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Loading...