You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/sql-reference/00-sql-reference/30-table-engines/00-fuse.md
+63-2Lines changed: 63 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Fuse Engine Tables
4
4
5
5
import FunctionDescription from '@site/src/components/FunctionDescription';
6
6
7
-
<FunctionDescriptiondescription="Introduced or updated: v1.2.733"/>
7
+
<FunctionDescriptiondescription="Introduced or updated: v1.2.73666666"/>
8
8
9
9
## Overview
10
10
@@ -133,10 +133,71 @@ Below are the available Fuse Engine options, grouped by their purpose:
133
133
134
134
---
135
135
136
+
### `enable_auto_vacuum`
137
+
-**Syntax:**
138
+
`enable_auto_vacuum = 0 / 1`
139
+
-**Description:**
140
+
Controls whether a table automatically triggers vacuum operations during mutations. This can be set globally as a setting for all tables or configured at the table level. The table-level option has a higher priority than the session/global setting of the same name. When enabled (set to 1), vacuum operations will be automatically triggered after mutations like INSERT or ALTER TABLE, cleaning up the table data according to the configured retention policy.
141
+
142
+
**Examples:**
143
+
```sql
144
+
-- Set enable_auto_vacuum globally for all tables across all sessions
145
+
SET GLOBAL enable_auto_vacuum =1;
146
+
147
+
-- Create a table with auto vacuum disabled (overrides global setting)
148
+
CREATE OR REPLACETABLEt1 (id INT) ENABLE_AUTO_VACUUM =0;
149
+
INSERT INTO t1 VALUES(1); -- Won't trigger vacuum despite global setting
150
+
151
+
-- Create another table that inherits the global setting
152
+
CREATE OR REPLACETABLEt2 (id INT);
153
+
INSERT INTO t2 VALUES(1); -- Will trigger vacuum due to global setting
154
+
155
+
-- Enable auto vacuum for an existing table
156
+
ALTERTABLE t1 SET OPTIONS(ENABLE_AUTO_VACUUM =1);
157
+
INSERT INTO t1 VALUES(2); -- Now will trigger vacuum
158
+
159
+
-- Table option takes precedence over global settings
160
+
SET GLOBAL enable_auto_vacuum =0; -- Turn off globally
161
+
-- t1 will still vacuum because table setting overrides global
162
+
INSERT INTO t1 VALUES(3); -- Will still trigger vacuum
163
+
INSERT INTO t2 VALUES(2); -- Won't trigger vacuum anymore
164
+
```
165
+
166
+
---
167
+
136
168
### `data_retention_num_snapshots_to_keep`
137
169
-**Syntax:**
138
170
`data_retention_num_snapshots_to_keep = <n>`
139
171
-**Description:**
140
-
Specifies the number of snapshots to retain for a table. This option works in conjunction with the `enable_auto_vacuum` setting to provide granular control over snapshot retention policies on a per-table basis. When set, only the specified number of most recent snapshots will be kept after vacuum operations.
172
+
Specifies the number of snapshots to retain during vacuum operations. This can be set globally as a setting for all tables or configured at the table level. The table-level option has a higher priority than the session/global setting of the same name. When set, only the specified number of most recent snapshots will be kept after vacuum operations. Overrides the `data_retention_time_in_days` setting. If set to 0, this setting will be ignored. This option works in conjunction with the `enable_auto_vacuum` setting to provide granular control over snapshot retention policies.
173
+
174
+
**Examples:**
175
+
```sql
176
+
-- Set global retention to 10 snapshots for all tables across all sessions
177
+
SET GLOBAL data_retention_num_snapshots_to_keep =10;
178
+
179
+
-- Create a table with custom snapshot retention (overrides global setting)
180
+
CREATE OR REPLACETABLEt1 (id INT)
181
+
enable_auto_vacuum =1
182
+
data_retention_num_snapshots_to_keep =5;
183
+
184
+
-- Create another table that inherits the global setting
185
+
CREATE OR REPLACETABLEt2 (id INT) enable_auto_vacuum =1;
186
+
187
+
-- When vacuum is triggered:
188
+
-- t1 will keep 5 snapshots (table setting)
189
+
-- t2 will keep 10 snapshots (global setting)
190
+
191
+
-- Change global setting
192
+
SET GLOBAL data_retention_num_snapshots_to_keep =20;
193
+
194
+
-- Table options still take precedence:
195
+
-- t1 will still keep only 5 snapshots
196
+
-- t2 will now keep 20 snapshots
197
+
198
+
-- Modify snapshot retention for an existing table
199
+
ALTERTABLE t1 SET OPTIONS(data_retention_num_snapshots_to_keep =3);
200
+
-- Now t1 will keep 3 snapshots when vacuum is triggered
0 commit comments