[ AliSQL DuckDB 引擎参数 | DuckDB Engine Variables in AliSQL ]
- Scope: Global
- Change type: Static (restart required)
- Data type: Enum
- Default:
NONE - Valid values:
NONE|ON - Description: Controls whether the DuckDB storage engine is enabled.
ONenables DuckDB;NONEdisables it. This variable is read-only and can only be set at startup.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
ON - Valid values:
ON|OFF - Description: Whether all DuckDB tables must define a primary key. If enabled, creating a table without a primary key will fail.
Notes:
- DuckDB tables do not actually create indexes. Uniqueness for PRIMARY KEY / UNIQUE KEY must be guaranteed by the user.
- When using a DuckDB node as a replica, you must enable this variable to ensure replication correctness.
- Scope: Global
- Change type: Dynamic
- Data type: Integer (bytes)
- Default:
0 - Valid range:
0~ULLONG_MAX - Step: 1024 bytes
- Description: Sets the maximum memory DuckDB is allowed to use.
0means automatic (typically ~80% of physical memory).
Note: When DuckDB is enabled, it is recommended to reduce
innodb_buffer_pool_sizeto free more memory for DuckDB.
- Scope: Global
- Change type: Static
- Data type: String
- Default: (empty)
- Description: Directory path where DuckDB writes temporary files. This variable is read-only and can only be configured before startup.
- Scope: Global
- Change type: Dynamic
- Data type: Integer (bytes)
- Default:
0(uses 90% of available disk space) - Valid range:
0~ULLONG_MAX - Step: 1024 bytes
- Description: Limits the maximum disk space DuckDB can use under
duckdb_temp_directory.0means automatic (typically ~90% of free disk space).
- Scope: Global
- Change type: Dynamic
- Data type: Integer
- Default:
0(auto) - Valid range:
0~1048576 - Description: Sets the total number of threads used by DuckDB.
0lets the system choose based on CPU cores.
- Scope: Global
- Change type: Static
- Data type: Boolean
- Default:
OFF - Valid values:
ON|OFF - Description: Whether to use Direct I/O to bypass the OS page cache for data reads/writes and improve large-file I/O performance. This variable is read-only and can only be set before startup.
Note: DuckDB Direct I/O is currently unstable and is not recommended.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
ON - Valid values:
ON|OFF - Description: Whether the scheduler partially processes tasks before rescheduling, which can improve fairness across concurrent queries.
- Scope: Session
- Change type: Dynamic
- Data type: Integer (rows)
- Default:
4611686018427387904 - Valid range:
0~4611686018427387904 - Description: If the row count of either table exceeds this threshold, DuckDB prefers Merge Join over Hash Join.
- Scope: Global
- Change type: Static (read-only)
- Data type: Boolean
- Default:
OFF - Valid values:
ON|OFF - Description: Whether to automatically convert all InnoDB tables to DuckDB tables during server startup. This variable is read-only and can only be configured before startup.
- Scope: Global
- Change type: Static (read-only)
- Data type: Boolean
- Default:
OFF - Valid values:
ON|OFF - Description: During startup conversion from InnoDB to DuckDB, whether to ignore conversion errors and continue. This variable is read-only and can only be configured before startup.
- Scope: Global
- Change type: Static
- Data type: Integer
- Default:
4 - Valid range:
1~64 - Description: Number of threads used to convert tables at startup to accelerate bulk migration. This variable is read-only and can only be configured before startup.
- Scope: Global
- Change type: Static
- Data type: Boolean
- Default:
OFF - Valid values:
ON|OFF - Description: Whether to skip a database named
mtrduring startup conversion. Typically used only for test purposes. This variable is read-only and can only be configured before startup.
- Scope: Session
- Change type: Dynamic
- Data type: Boolean
- Default:
OFF - Valid values:
ON|OFF - Description: Disables collation pushdown optimization and forces binary comparison. If your queries do not care about collation/case order, setting this to
ONmay improve performance.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
OFF - Valid values:
ON|OFF - Description: When a transaction contains only INSERT operations, whether to set an
insert_onlyflag in the binlog to optimize replication performance.
- Scope: Session
- Change type: Dynamic
- Data type: Enum
- Default:
PHYSICAL_ONLY - Valid values:
ALL|OPTIMIZED_ONLY|PHYSICAL_ONLY - Description: Controls the default output format of DuckDB
EXPLAIN: all plans, optimized plan only, or physical plan only.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
OFF - Valid values:
ON|OFF - Description: Whether to merge multiple transactions from the relay log into a single batch commit to improve throughput. Effective only on replicas.
- Scope: Global
- Change type: Dynamic
- Data type: Integer (ms)
- Default:
5000ms - Valid range:
0~100000 - Description: Commit delay timeout (milliseconds) used to wait for more transactions to join the same batch. Effective only on replicas.
- Scope: Global
- Change type: Dynamic
- Data type: Integer (bytes)
- Default:
256MB - Valid range:
0~ULLONG_MAX - Description: Maximum batch size in bytes. Once reached, the batch is committed immediately. Effective only on replicas.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
ON - Valid values:
ON|OFF - Description: When the relay log is empty, whether to trigger a multi-transaction batch commit. Effective only on replicas.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
ON - Valid values:
ON|OFF - Description: Deprecated. Whether to commit multiple transactions when a Rotate Event is received from the primary. Effective only on replicas.
- Scope: Global
- Change type: Dynamic
- Data type: Integer
- Default:
1 - Valid range:
0~1048576 - Description: When
duckdb_commit_multi_trx_due_to_rotateis enabled, commit once per N binlog rotate events.0means never;1means every time. Effective only on replicas.
- Scope: Session
- Change type: Dynamic
- Data type: Integer
- Default:
4 - Valid range:
0~64 - Description: Number of threads used during DDL conversion from InnoDB to DuckDB. The parallel conversion uses InnoDB parallel read infrastructure, but this thread count is not controlled by
innodb_parallel_read_threads.
- Scope: Global
- Change type: Dynamic
- Data type: Integer (bytes)
- Default:
268435456(256MB) - Valid range:
0~ULLONG_MAX - Step: 1024 bytes
- Description: Automatically triggers a checkpoint when DuckDB WAL reaches this size.
- Scope: Global
- Change type: Static
- Data type: Boolean
- Default:
ON - Valid values:
ON|OFF - Description: DuckDB does not support DECIMAL precision > 38. This variable controls whether to use DOUBLE instead for DECIMAL with precision > 38. This variable is read-only and can only be set before startup.
Note: This affects the actual column type and should not be changed after the instance is created.
- Scope: Session
- Change type: Dynamic
- Data type: Enum set
- Default:
0(empty set) - Valid values:
EXPRESSION_REWRITER,FILTER_PULLUP,FILTER_PUSHDOWN,EMPTY_RESULT_PULLUP,
CTE_FILTER_PUSHER,REGEX_RANGE,IN_CLAUSE,JOIN_ORDER,DELIMINATOR,
UNNEST_REWRITER,UNUSED_COLUMNS,STATISTICS_PROPAGATION,COMMON_SUBEXPRESSIONS,
COMMON_AGGREGATE,COLUMN_LIFETIME,BUILD_SIDE_PROBE_SIDE,LIMIT_PUSHDOWN,
TOP_N,COMPRESSED_MATERIALIZATION,DUPLICATE_GROUPS,REORDER_FILTER,
SAMPLING_PUSHDOWN,JOIN_FILTER_PUSHDOWN,EXTENSION,MATERIALIZED_CTE,
SUM_REWRITER,LATE_MATERIALIZATION - Description: Disables the specified optimizer rules in DuckDB.
- Scope: Session
- Change type: Dynamic
- Data type: Boolean
- Default:
OFF - Valid values:
ON|OFF - Description: Enables data import mode. In this mode, only DELETE and INSERT operations with constant equality predicates on the primary key are supported.
Notes:
- Intended for bulk import: merges multiple INSERT/DELETE operations into a single batch to improve performance.
- This variable cannot be changed inside a transaction.
- When
ON, the modified table must have a primary key.- When
ON, UPDATE is not supported; rewrite UPDATE as DELETE + INSERT.- When
ON, unsupported DML will raise an error.- This variable takes effect only when
duckdb_dml_in_batchis enabled.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
OFF - Valid values:
ON|OFF - Description: When
duckdb_data_import_mode=ON, enables idempotent data import. If enabled, re-importing the same data (e.g., after restart/recovery) will not create duplicates.
Note: Enabling idempotent import may reduce import performance.
- Scope: Global
- Change type: Dynamic
- Data type: Integer (bytes)
- Default:
64MB - Valid range:
0~ULLONG_MAX - Step: 1024 bytes
- Description: When DuckDB writes data in batches, if batch memory usage reaches this threshold, DuckDB proactively flushes to release memory and avoid OOM.
- Scope: Global
- Change type: Dynamic
- Data type: Enum set
- Default:
0(no logging) - Valid values:
DUCKDB_MULTI_TRX_BATCH_COMMIT,DUCKDB_MULTI_TRX_BATCH_DETAIL,DUCKDB_QUERY,DUCKDB_QUERY_RESULT - Description: Selects which DuckDB operations are logged for debugging and auditing.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
OFF - Valid values:
ON|OFF - Description: When creating tables or running DDL, whether to force-replace the InnoDB engine with DuckDB. Useful for testing or migration scenarios.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
ON - Valid values:
ON|OFF - Description: Whether to use batch inserts to accelerate DDL conversion from InnoDB to DuckDB. Enabling this can significantly improve conversion performance.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
ON - Valid values:
ON|OFF - Description: Enables batch mode to accelerate DML (INSERT/UPDATE/DELETE). When enabled, multiple changes can be merged into batches to improve throughput and reduce transaction overhead.
Notes:
- When enabled on a DuckDB replica and the primary uses row-based binlog, DuckDB automatically batches DML during replay.
- When enabled on a DuckDB primary, INSERT can be batched; whether DELETE can be batched depends on
duckdb_data_import_modeand its constraints; UPDATE cannot be batched.
- Scope: Global
- Change type: Dynamic
- Data type: Boolean
- Default:
ON - Valid values:
ON|OFF - Description: During binlog replay, whether to update only the columns that actually changed. Enabling this reduces unnecessary writes and improves replication efficiency while lowering I/O and memory pressure.