Short rule (memorize this)
PostgreSQL supports transactional DDL; MySQL and Oracle mostly do not.
Now the precise breakdown 👇
PostgreSQL
✅ Best-in-class transactional DDL
Supports rollback for most DDL:
BEGIN;
ALTER TABLE users ADD COLUMN age INT;
ROLLBACK; -- works
Transactional
CREATE TABLEALTER TABLEDROP TABLEADD/DROP COLUMNCREATE INDEX(normal)
NOT transactional (exceptions)
CREATE INDEX CONCURRENTLYDROP INDEX CONCURRENTLYVACUUM- some
ALTER TYPE ... ADD VALUE(older versions)
📌 This is why Postgres is loved in modern backend systems.
⚠️ Databases with partial / limited transactional behavior
SQL Server
- DDL runs inside transactions
- But many operations auto-commit or acquire locks aggressively
Works
CREATE TABLEALTER TABLE
Problematic
- Index rebuilds
- Partition changes
- Some schema ops ignore rollback semantics
⚠️ Transaction support exists, but behavior can surprise you.
❌ Databases that mostly do NOT support transactional DDL
MySQL / MariaDB
🚫 DDL auto-commits
BEGIN;
ALTER TABLE users ADD COLUMN age INT;
ROLLBACK; -- does nothing
Each DDL = implicit commit
Partial failures leave schema half-changed
Engine-dependent quirks (InnoDB helps for data, not schema)
Oracle
🚫 DDL always auto-commits
ALTER TABLE users ADD age NUMBER;
-- implicit commit before and after
- No rollback possible
- Even a failed DDL may commit previous changes
This is why Oracle migrations are very carefully staged.
Summary table (this is gold for interviews)
| Database | Transactional DDL? | Reality |
|---|---|---|
| PostgreSQL | ✅ Yes | Best support, with a few exceptions |
| SQL Server | ⚠️ Partial | Mostly transactional, many caveats |
| MySQL | ❌ No | DDL auto-commits |
| MariaDB | ❌ No | Same as MySQL |
| Oracle | ❌ No | DDL auto-commits |
| SQLite | ⚠️ Partial | Limited, file-level locks |
Why migration tools can’t “fix” this
Migration tools respect database semantics — they cannot add transactions where the DB doesn’t support them.
So:
- Flyway/Liquibase wrap when possible
- Disable transactions otherwise
- Fail fast or leave partial state
Interview-ready answer (2 sentences)
PostgreSQL fully supports transactional DDL, allowing migrations to roll back safely, while MySQL and Oracle treat most DDL as auto-committing and non-transactional.
Migration tools adapt to these constraints, which is why non-transactional databases require extra care and forward-only recovery strategies.
Senior takeaway
Choose Postgres if you want safe schema evolution.
Choose Oracle/MySQL if you accept operational complexity.