Very big transaction in a stored procedure : how can i commit in the middle of it ?

Поиск
Список
Период
Сортировка
От Célestin HELLEU
Тема Very big transaction in a stored procedure : how can i commit in the middle of it ?
Дата
Msg-id 7B8930A41ECB4844A5518D65E0D4C841491005@mainlan1.paris.maporama.com
обсуждение исходный текст
Ответы Re: Very big transaction in a stored procedure : how can i commit in the middle of it ?  (Martijn van Oosterhout <kleptog@svana.org>)
Список 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 

В списке pgsql-general по дате отправления:

Предыдущее
От: Célestin HELLEU
Дата:
Сообщение: Very big transaction in a stored procedure : how can i commit in the middle of it ?
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Very big transaction in a stored procedure : how can i commit in the middle of it ?