{
    "content": [
        {
            "type": "text",
            "text": "# BEGIN (info)\n\n## NAME\n\nBEGIN - start a transaction block\n\n## SYNOPSIS\n\nBEGIN [ WORK | TRANSACTION ] [ transactionmode [, ...] ]\nwhere transactionmode is one of:\nISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }\nREAD WRITE | READ ONLY\n[ NOT ] DEFERRABLE\n\n## DESCRIPTION\n\nBEGIN 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\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PARAMETERS**\n- **NOTES**\n- **EXAMPLES**\n- **COMPATIBILITY**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "BEGIN",
        "section": "",
        "mode": "info",
        "summary": "BEGIN - start a transaction block",
        "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",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "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"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "COMPATIBILITY",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            }
        ],
        "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": []
            }
        }
    }
}