What does autocommit mean in postgresql and psycopg2?

后端 未结 1 1384
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-16 06:42

Does autocommit mean the same in PostgreSQL and Psycopg2?

From PostgreSQL manual

By default (without BEGIN ), PostgreSQL executes transacti

1条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-16 07:35

    Every PostgreSQL statement is running in a transaction.

    PostgreSQL itself only knows autocommit mode, which means that each statement will run in its own transaction if you don't start a transaction explicitly.

    Statements like VACUUM cannot run in the same transaction with other statements.

    If you are not using autocommit in psycopg2, the driver has to simulate non-autocommit mode by explicitly starting a transaction when the first statement is run.

    0 讨论(0)
提交回复
热议问题