[Python] Is there any reason not to use autocommit?

Discussão em 'Python' iniciado por Stack, Fevereiro 21, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using psycopg2 to manage some Postgresql database connections.

    As I have found here and in the docs, it seems psycopg2 simulates non-autocommit mode as default. Also PostgreSQL treats every statement as a transaction, basically autocommit mode.

    My doubt is, which one of these cases happens if both psycopg and PostgreSQL stay in default mode? Or what exactly happens if it's neither one of these two? Any performance advice will be appreciated too.

    Code Psycopg2 Postgresql

    Some statements --> One big transaction --> Multiple simple transactions
    or
    Some statements --> One big transaction --> Big transaction

    Continue reading...

Compartilhe esta Página