Home > database >  PostgreSQL, please write into the SQL, if it is a circular insert, commit how should handle?
PostgreSQL, please write into the SQL, if it is a circular insert, commit how should handle?

Time:10-11

So, I want to read the article 500000 data from other places is inserted into the database of PG, excuse me I in the loop, is each SQL execution, after a commit, or, after the completion of all the SQL execution in the commit,
A:
 
For the item in the pool:
SQL="" "" insert into... "
"Po_cursor. Execute (SQL)
MIT ()
conn_pg.com

2:
 
For the item in the pool:
SQL="" "" insert into... "
"Po_cursor. Execute (SQL)
MIT ()
conn_pg.com


Bosses can with small white under the science

CodePudding user response:

Can be partial, such as 1000 or so a commit

CodePudding user response:

reference 1st floor trainee response:
can be partial, such as 1000 or so a commit

Article 500000 a commmit data to the database have any impact on the

CodePudding user response:

Will have little impact, but if a commit 500000 data, if one account has a problem, all will be rolled back,

CodePudding user response:

Considering the PG MVCC mechanism and most production libraries are open to the isolation of the read committed, nothing, in addition to wal_log may space is not enough, but article 500000 normal has dozens of hundreds of M, possibility is not big,