I think deferred triggers can also use a lot of memory.
I do indeed have several columns with REFERENCES x DEFERRABLE INITIALLY DEFERRED...
Next time I run the procedure, I will try dropping the foreign key constraints first.
Incidently, would be nice if Postgres had something like Oracle's NOVALIDATE clause, as I can be certain that the foreign keys are valid!
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq