From: | Célestin HELLEU <celestin(dot)helleu(at)maporama(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Very big transaction in a stored procedure : how can i commit in the middle of it ? |
Date: | 2007-05-24 14:30:19 |
Message-ID: | 7B8930A41ECB4844A5518D65E0D4C841491006@mainlan1.paris.maporama.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I already know that transaction is impossible inside a function, but I think I really need a way to counter this
I have a stored procedure in pl/sql that makes about 2 000 000 insert. With the way it works, PostGreSQL il making a unique transaction with all this, resulting so bad performances I can't wait the procedure to finish
I must find a way to make commit between INSERT.
Thanks in advance,
Célestin
Here is the skeleton of my code :
CREATE OR REPLACE FUNCTION F2(...) AS
$$ DECLARE
...
BEGIN
...
FOR ligne IN ...
...
LOOP
NSERT INTO
< place I wish I could put a commit >
END LOOP
...
END $$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION F1(...) AS
$$ DECLARE
BEGIN
FOR all IN ...
LOOP
PERFORM F2(...)
< another place I could put my commit >
END LOOP
...
END $$ LANGUAGE plpgsql;
2007 - Maporama International - Outgoing mail scanned by BlackSpider
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2007-05-24 14:48:16 | Re: Very big transaction in a stored procedure : how can i commit in the middle of it ? |
Previous Message | Merlin Moncure | 2007-05-24 14:25:35 | Re: composite type array and index |