{
    "mode": "info",
    "parameter": "BEGIN",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/BEGIN/json",
    "generated": "2026-08-02T06:33:18Z",
    "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\nBEGIN command will be executed in a single transaction until an\nexplicit COMMIT or ROLLBACK is given. By default (without BEGIN),\nPostgreSQL executes transactions in \"autocommit\" mode, that is, each\nstatement is executed in its own transaction and a commit is implicitly\nperformed at the end of the statement (if execution was successful,\notherwise a rollback is done).\n\nStatements are executed more quickly in a transaction block, because\ntransaction start/commit requires significant CPU and disk activity.\nExecution of multiple statements inside a transaction is also useful to\nensure consistency when making several related changes: other sessions\nwill be unable to see the intermediate states wherein not all the\nrelated updates have been done.\n\nIf the isolation level, read/write mode, or deferrable mode is\nspecified, the new transaction has those characteristics, as if SET\nTRANSACTION 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\nmeaning of the other parameters 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\nwarning message. The state of the transaction is not affected. To nest\ntransactions within a transaction block, use savepoints (see\nSAVEPOINT(7)).\n\nFor reasons of backwards compatibility, the commas between successive\ntransactionmodes can be 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\nSQL-standard command START TRANSACTION, whose reference page contains\nadditional compatibility information.\n\nThe DEFERRABLE transactionmode is a PostgreSQL language extension.\n\nIncidentally, the BEGIN key word is used for a different purpose in\nembedded SQL. You are advised to be careful about the transaction\nsemantics when porting database applications.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "COMMIT(7), ROLLBACK(7), START TRANSACTION (STARTTRANSACTION(7)),\nSAVEPOINT(7)\n\nPostgreSQL 14.23                     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"
        }
    ]
}