Skip to content

Commit 8b22c6b

Browse files
docs: update transaction mode (#896)
* update transaction mode * remove tm in setting
1 parent c97be76 commit 8b22c6b

File tree

5 files changed

+40
-15
lines changed

5 files changed

+40
-15
lines changed

mintlify/change-database/settings.mdx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,6 @@ title: Settings
44

55
Customize how database changes work in your projects. Navigate to **Project****Settings** to access these options.
66

7-
## Transaction Mode
8-
9-
<Note>
10-
Supported databases: MySQL, PostgreSQL, Oracle, SQL Server, TiDB, Redshift
11-
</Note>
12-
13-
By default, Bytebase wraps SQL statements in a transaction for safety - if something goes wrong, changes can be rolled back.
14-
15-
Some DDL statements can't run inside transactions. To disable transaction wrapping, add this comment before your SQL:
16-
17-
```sql
18-
-- txn-mode=off
19-
ALTER TABLE t ALTER COLUMN a TYPE VARCHAR(255);
20-
```
21-
227
## Postgres Tenant Mode
238

249
Perfect for multi-tenant PostgreSQL setups where each database has its own owner.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Transaction Mode
3+
---
4+
5+
<Note>
6+
Supported databases: MySQL, PostgreSQL, Oracle, SQL Server, TiDB, Redshift
7+
</Note>
8+
9+
Bytebase provides transaction management to ensure safe database changes. By default, all SQL statements are wrapped in a transaction, allowing automatic rollback if errors occur during execution.
10+
11+
## Enable/Disable Transactions
12+
13+
When creating a plan, you can control whether SQL statements are executed within a transaction:
14+
15+
- **Enabled (default)**: All statements run within a transaction boundary for safety
16+
- **Disabled**: Statements execute directly without transaction wrapping
17+
18+
![Transaction mode toggle](/content/docs/change-database/transaction-mode/bb-transaction-mode.webp)
19+
20+
## MySQL-Specific Settings
21+
22+
For MySQL databases, Bytebase offers additional control over transaction isolation levels to manage concurrent access and data consistency:
23+
24+
![MySQL transaction isolation levels](/content/docs/change-database/transaction-mode/bb-transaction-mode-mysql.webp)
25+
26+
### Available Isolation Levels
27+
28+
- **READ UNCOMMITTED**: Lowest isolation, allows dirty reads
29+
- **READ COMMITTED**: Prevents dirty reads, allows non-repeatable reads
30+
- **REPEATABLE READ**: Default MySQL isolation, prevents dirty and non-repeatable reads
31+
- **SERIALIZABLE**: Highest isolation, prevents all phenomena but may impact performance
32+
33+
## Best Practices
34+
35+
- Keep transactions enabled for DDL and DML operations that modify data
36+
- Consider disabling transactions only for:
37+
- Large batch operations that manage their own transaction boundaries
38+
- Statements that cannot run within transactions (e.g., certain administrative commands)
39+
- Choose appropriate isolation levels based on your concurrency requirements and performance needs
20.8 KB
Loading
16.3 KB
Loading

mintlify/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"group": "Change",
9696
"pages": [
9797
"change-database/plan",
98+
"change-database/transaction-mode",
9899
"change-database/batch-change",
99100
"change-database/synchronize-schema",
100101
"change-database/online-schema-migration-for-mysql",

0 commit comments

Comments
 (0)