{
    "mode": "man",
    "parameter": "BEGIN",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/BEGIN/7/json",
    "generated": "2026-10-06T03:04:21Z",
    "synopsis": "BEGIN [ WORK | TRANSACTION ] [ transactionmode [, ...] ]\nwhere transactionmode is one of:\nISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\nREAD WRITE | READ ONLY\n[ NOT ] DEFERRABLE",
    "sections": {
        "NAME": {
            "content": "BEGIN - start a transaction block\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "BEGIN [ WORK | TRANSACTION ] [ transactionmode [, ...] ]\n\nwhere transactionmode is one of:\n\nISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\nREAD WRITE | READ ONLY\n[ NOT ] DEFERRABLE\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "BEGIN initiates a transaction block, that is, all statements after a BEGIN command will be\nexecuted in a single transaction until an explicit COMMIT or ROLLBACK is given. By default\n(without BEGIN), PostgreSQL executes transactions in “autocommit” mode, that is, each\nstatement is executed in its own transaction and a commit is implicitly performed at the end\nof the statement (if execution was successful, otherwise a rollback is done).\n\nStatements are executed more quickly in a transaction block, because transaction start/commit\nrequires significant CPU and disk activity. Execution of multiple statements inside a\ntransaction is also useful to ensure consistency when making several related changes: other\nsessions will be unable to see the intermediate states wherein not all the related updates\nhave been done.\n\nIf the isolation level, read/write mode, or deferrable mode is specified, the new transaction\nhas those characteristics, as if SET TRANSACTION was executed.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "WORK\nTRANSACTION\nOptional key words. They have no effect.\n\nRefer to SET TRANSACTION (SETTRANSACTION(7)) for information on the meaning of the other\nparameters to this statement.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "START TRANSACTION has the same functionality as BEGIN.\n\nUse COMMIT or ROLLBACK to terminate a transaction block.\n\nIssuing BEGIN when already inside a transaction block will provoke a warning message. The\nstate of the transaction is not affected. To nest transactions within a transaction block,\nuse savepoints (see SAVEPOINT(7)).\n\nFor reasons of backwards compatibility, the commas between successive transactionmodes can\nbe omitted.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "To begin a transaction block:\n\nBEGIN;\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "BEGIN is a PostgreSQL language extension. It is equivalent to the SQL-standard command START\nTRANSACTION, whose reference page contains additional compatibility information.\n\nThe DEFERRABLE transactionmode is a PostgreSQL language extension.\n\nIncidentally, the BEGIN key word is used for a different purpose in embedded SQL. You are\nadvised to be careful about the transaction semantics when porting database applications.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "COMMIT(7), ROLLBACK(7), START TRANSACTION (STARTTRANSACTION(7)), SAVEPOINT(7)\n\nPostgreSQL 16.14                                2026                                        BEGIN(7)",
            "subsections": []
        }
    },
    "summary": "BEGIN - start a transaction block",
    "flags": [],
    "examples": [
        "To begin a transaction block:",
        "BEGIN;"
    ],
    "see_also": [
        {
            "name": "COMMIT",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/COMMIT/7/json"
        },
        {
            "name": "ROLLBACK",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/ROLLBACK/7/json"
        },
        {
            "name": "STARTTRANSACTION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/STARTTRANSACTION/7/json"
        },
        {
            "name": "SAVEPOINT",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/SAVEPOINT/7/json"
        }
    ]
}