COMMIT in a PostgreSQL stored procedure

I have a PostgreSQL stored procedure that moves around a very large list and makes changes to some of its elements using UPDATE.

Is there a way to commit these changes to iteration, and not at the end of the function? This would allow me to run the function for short periods of time, making small changes at each start.

Thank,

Adam

+3
source share
2 answers

No, it is not currently supported for opening or closing transactions within a stored procedure, no.

, btw, , . , , 10 000 100 000 . , , , , ISAM, , - .

+3

, , , ...

FOR all IN (select * from TABLE1)
LOOP
    FOR some IN (select * from)
    LOOP
        INSERT INTO TABLE2 VALUES (all.id, some.id)
    END LOOP
END LOOP

INSERT:

INSERT INTO TABLE2 SELECT all.id, some.id FROM all, some WHERE...

, . , . -, , . , , , .

+1

Source: https://habr.com/ru/post/1733743/


All Articles