{
    "url": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback",
    "locale": "en",
    "title": "BEGIN / COMMIT / ROLLBACK: Knowledge hub | DeLaParra Services",
    "description": "Start a transaction, then make all its changes permanent (COMMIT) or throw them all away (ROLLBACK).",
    "alternates": {
        "en": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback",
        "nl": "https://delaparra-services.nl/nl/kennisbank/begin-commit-rollback"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.csv",
        "md": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.md",
        "json": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.json",
        "zip": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.zip",
        "pdf": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.csv",
            "encodingFormat": "text/csv",
            "name": "begin-commit-rollback.csv"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.json",
            "encodingFormat": "application/json",
            "name": "begin-commit-rollback.json"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.md",
            "encodingFormat": "text/markdown",
            "name": "begin-commit-rollback.md"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.pdf",
            "encodingFormat": "application/pdf",
            "name": "begin-commit-rollback.pdf"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.zip",
            "encodingFormat": "application/zip",
            "name": "begin-commit-rollback.zip"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback/skills.zip",
            "encodingFormat": "application/zip",
            "name": "begin-commit-rollback-skills.zip"
        }
    ],
    "markdown": "1. [Home](<https://delaparra-services.nl/>) \n1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) \n1. [BEGIN / COMMIT / ROLLBACK](<https://delaparra-services.nl/knowledge-hub/begin-commit-rollback>)\n\n  \n\nCategory: SQL \n\n# BEGIN / COMMIT / ROLLBACK\n\n  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    \n\n## What is BEGIN / COMMIT / ROLLBACK?\n\n \n\nBEGIN / COMMIT / ROLLBACK: Start a transaction, then make all its changes permanent (COMMIT) or throw them all away (ROLLBACK). ` BEGIN `, ` COMMIT ` and ` ROLLBACK ` control a database transaction. ` BEGIN ` starts it. All changes after that are provisional. ` COMMIT ` makes them permanent, and ` ROLLBACK ` throws them all away. This is useful in two ways. In application code, it keeps related changes together, so a crash or error cannot leave half an order in the database. In a manual session, it gives you a safety net: run a risky ` DELETE ` inside a transaction, check how many rows it affected, and roll back if the number is wrong.\n\n \n\nDefinition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)\n\n \n\n## Frequently asked questions about BEGIN / COMMIT / ROLLBACK\n\n  \n\n### What should you keep in mind with BEGIN / COMMIT / ROLLBACK?\n\n \n\nSome statements, such as schema changes in MySQL, commit automatically and cannot be rolled back. Check how your database handles them before relying on a transaction. And do not leave a transaction open in a console while you go for coffee; it can block other queries.\n\n    \n\n### What does an example of BEGIN / COMMIT / ROLLBACK look like?\n\n \n\n```\nBEGIN; DELETE FROM logs WHERE created_at < now() - interval '90 days'; ROLLBACK; -- changed my mind\n```\n\n \n\n## At a glance\n\n   CategorySQL Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026\n\n \n\n## More SQL terms\n\n \n\n- [ACID](<https://delaparra-services.nl/knowledge-hub/acid>) \n- [B-tree index](<https://delaparra-services.nl/knowledge-hub/b-tree-index>) \n- [CASE](<https://delaparra-services.nl/knowledge-hub/case>) \n- [COALESCE](<https://delaparra-services.nl/knowledge-hub/coalesce>) \n- [composite index](<https://delaparra-services.nl/knowledge-hub/composite-index>) \n- [COUNT / SUM / AVG / MIN / MAX](<https://delaparra-services.nl/knowledge-hub/count-sum-avg-min-max>)\n\n \n\n[All terms starting with B](<https://delaparra-services.nl/knowledge-hub#letter-b>)\n\n \n\n## Skills\n\n \n\n- ### Concurrency pitfalls\n\n \n\nUse when code runs things at the same time - threads, async/await, queues and workers, parallel requests, cron jobs, webhooks that retry - or when a bug only happens \"sometimes\" or under load. Covers race conditions, deadlocks, mutexes/locks, atomic operations, idempotency, message queues and backpressure, with Laravel and database examples.\n\n [View skill](<https://delaparra-services.nl/skills/concurrency-pitfalls>) [Download zip](<https://delaparra-services.nl/skills/concurrency-pitfalls/download>) \n- ### SQL Optimization Patterns\n\n \n\nMaster SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.\n\n [View skill](<https://delaparra-services.nl/skills/sql-optimization-patterns>) [Download zip](<https://delaparra-services.nl/skills/sql-optimization-patterns/download>) \n- ### Laravel Database Optimization\n\n \n\nLaravel database optimization patterns. Use when writing Eloquent queries, creating migrations, configuring caching, debugging slow queries, or optimizing database performance. Triggers on tasks involving N+1 queries, indexing, Redis caching, pagination, or database transactions.\n\n [View skill](<https://delaparra-services.nl/skills/laravel-database-optimization>) [Download zip](<https://delaparra-services.nl/skills/laravel-database-optimization/download>)\n\n [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/begin-commit-rollback/skills.zip>)\n\n \n\n## Manuals\n\n \n\n- [Writing SQL queries and migrations](<https://delaparra-services.nl/manuals/sql-queries-en-migraties>)\n\n \n\n## Related services\n\n \n\n- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)\n\nPerhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet. \n- [AI code review](<https://delaparra-services.nl/services#service-05>)\n\nWhen you push your new change, I will review your code, help your agent avoid the same mistake again, and get your app ready for deployment.\n\n \n\n## Need any help?\n\n \n\nStuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.\n\n  [Get in touch](<https://delaparra-services.nl/availability>)\n\n[HTML version](https://delaparra-services.nl/knowledge-hub/begin-commit-rollback)\n",
    "structured_data": {
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": "Organization",
                "@id": "https://delaparra-services.nl/#practice",
                "logo": "https://delaparra-services.nl/logo.png",
                "name": "DeLaParra Services",
                "legalName": "DeLaParra Services",
                "url": "https://delaparra-services.nl/",
                "description": "Bespoke software, web applications and mobile apps, developed in Laravel by a single developer in Groningen. Fixed price agreed in advance, full source code provided upon delivery.",
                "email": "info@delaparra-services.nl",
                "address": {
                    "@type": "PostalAddress",
                    "addressLocality": "Groningen",
                    "addressRegion": "Groningen",
                    "addressCountry": "NL"
                },
                "areaServed": "Groningen, the Netherlands",
                "knowsLanguage": [
                    "en",
                    "nl"
                ],
                "knowsAbout": [
                    "Web design and development",
                    "App development",
                    "Custom software and web applications",
                    "OpenSpec",
                    "AI code review",
                    "Your own coding agent"
                ],
                "founder": {
                    "@id": "https://delaparra-services.nl/#person"
                }
            },
            {
                "@type": "FAQPage",
                "@id": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback#webpage",
                "url": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback",
                "name": "BEGIN / COMMIT / ROLLBACK: Knowledge hub | DeLaParra Services",
                "description": "Start a transaction, then make all its changes permanent (COMMIT) or throw them all away (ROLLBACK).",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@type": "DefinedTerm",
                    "@id": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback#term",
                    "name": "BEGIN / COMMIT / ROLLBACK",
                    "description": "Start a transaction, then make all its changes permanent (COMMIT) or throw them all away (ROLLBACK).",
                    "termCode": "begin-commit-rollback",
                    "url": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback",
                    "inLanguage": "en",
                    "keywords": "SQL",
                    "dateModified": "2026-11-25T17:46:25+00:00",
                    "inDefinedTermSet": {
                        "@id": "https://delaparra-services.nl/knowledge-hub#terms"
                    },
                    "isPartOf": {
                        "@id": "https://delaparra-services.nl/knowledge-hub#dataset"
                    },
                    "subjectOf": [
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback#webpage"
                        },
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback#dataset"
                        }
                    ]
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback#breadcrumb"
                },
                "mainEntity": [
                    {
                        "@type": "Question",
                        "name": "What is BEGIN / COMMIT / ROLLBACK?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "Start a transaction, then make all its changes permanent (COMMIT) or throw them all away (ROLLBACK). BEGIN, COMMIT and ROLLBACK control a database transaction. BEGIN starts it. All changes after that are provisional. COMMIT makes them permanent, and ROLLBACK throws them all away. This is useful in two ways. In application code, it keeps related changes together, so a crash or error cannot leave half an order in the database. In a manual session, it gives you a safety net: run a risky DELETE inside a transaction, check how many rows it affected, and roll back if the number is wrong."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What should you keep in mind with BEGIN / COMMIT / ROLLBACK?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "Some statements, such as schema changes in MySQL, commit automatically and cannot be rolled back. Check how your database handles them before relying on a transaction. And do not leave a transaction open in a console while you go for coffee; it can block other queries."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What does an example of BEGIN / COMMIT / ROLLBACK look like?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "BEGIN; DELETE FROM logs WHERE created_at < now() - interval '90 days'; ROLLBACK; -- changed my mind"
                        }
                    }
                ],
                "author": {
                    "@id": "https://delaparra-services.nl/#person"
                },
                "mentions": [
                    {
                        "@id": "https://delaparra-services.nl/skills/concurrency-pitfalls#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/skills/sql-optimization-patterns#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/skills/laravel-database-optimization#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/manuals/sql-queries-en-migraties#article"
                    }
                ]
            },
            {
                "@type": "BreadcrumbList",
                "@id": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback#breadcrumb",
                "itemListElement": [
                    {
                        "@type": "ListItem",
                        "position": 1,
                        "name": "Home",
                        "item": "https://delaparra-services.nl/"
                    },
                    {
                        "@type": "ListItem",
                        "position": 2,
                        "name": "Knowledge hub",
                        "item": "https://delaparra-services.nl/knowledge-hub"
                    },
                    {
                        "@type": "ListItem",
                        "position": 3,
                        "name": "BEGIN / COMMIT / ROLLBACK"
                    }
                ]
            },
            {
                "@type": "Person",
                "@id": "https://delaparra-services.nl/#person",
                "name": "Reinier de la Parra",
                "url": "https://delaparra-services.nl/about"
            },
            {
                "@type": "Dataset",
                "@id": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback#dataset",
                "name": "BEGIN / COMMIT / ROLLBACK",
                "description": "Start a transaction, then make all its changes permanent (COMMIT) or throw them all away (ROLLBACK).",
                "url": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback",
                "identifier": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback#term"
                },
                "creator": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "publisher": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "license": "https://creativecommons.org/licenses/by/4.0/",
                "creditText": "Coders Lingo (https://coderslingo.com/resources/open-dataset/), CC BY 4.0",
                "isAccessibleForFree": true,
                "inLanguage": "en",
                "keywords": "SQL",
                "version": "2026-11-25",
                "dateModified": "2026-11-25T17:46:25+00:00",
                "isPartOf": {
                    "@type": "Dataset",
                    "@id": "https://delaparra-services.nl/knowledge-hub#dataset",
                    "name": "IT terms from A to Z",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "includedInDataCatalog": {
                    "@type": "DataCatalog",
                    "@id": "https://delaparra-services.nl/knowledge-hub#catalog",
                    "name": "Knowledge hub data catalog",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "distribution": [
                    {
                        "@type": "DataDownload",
                        "name": "begin-commit-rollback.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "begin-commit-rollback.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "begin-commit-rollback.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "begin-commit-rollback.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "begin-commit-rollback.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "begin-commit-rollback-skills.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/begin-commit-rollback/skills.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    }
                ]
            }
        ]
    }
}