Skip to main content
Version: 0.2.3

Configuration Reference

Connection Pool Settings

SettingTypeDefaultRangeDescription
mssql_connection_limitBIGINT64≥1Max connections per attached database
mssql_connection_cacheBOOLEANtrue-Enable connection pooling and reuse
mssql_reset_connectionBOOLEANtrue-Reset session state when a connection returns to the pool (details)
mssql_connection_timeoutBIGINT30≥0TCP connection timeout (seconds)
mssql_idle_timeoutBIGINT300≥0Idle connection timeout (seconds, 0=none)
mssql_min_connectionsBIGINT0≥0Minimum connections to maintain
mssql_acquire_timeoutBIGINT30≥0Connection acquire timeout (seconds)
mssql_query_timeoutBIGINT30≥0Query execution timeout (seconds, 0=infinite)
mssql_metadata_timeoutBIGINT300≥0Metadata query timeout (seconds, 0=no timeout)
mssql_catalog_cache_ttlBIGINT0≥0Metadata cache TTL (seconds, 0=manual)
mssql_exec_invalidate_cacheBOOLEANfalsetrue/falseAuto-invalidate the catalog cache after DDL run via mssql_exec(). Default false (like the Postgres extension's postgres_execute): invalidate manually with mssql_invalidate_cache() after schema-changing DDL. Set true to auto-invalidate.
mssql_attach_validation_timeoutBIGINT0≥0ATTACH-time eager-validation timeout (seconds). 0 inherits mssql_connection_timeout. Spec 047 FR-011.

Statistics Settings

SettingTypeDefaultRangeDescription
mssql_enable_statisticsBOOLEANtrue-Enable statistics collection
mssql_statistics_levelBIGINT0≥0Detail: 0=rowcount, 1=+histogram, 2=+NDV
mssql_statistics_use_dbccBOOLEANfalse-Use DBCC SHOW_STATISTICS (requires permissions)
mssql_statistics_cache_ttl_secondsBIGINT300≥0Statistics cache TTL (seconds)

Wire Protocol Settings

SettingTypeDefaultDescription
mssql_tds_packet_sizeBIGINT16384TDS frame size requested at login, clamped to [512, 32767]. Bounds recv() count on reads and send() count on bulk loads; raised from 4096 in v0.2.3 (−28% client CPU / −43% wall on read). Costs the server ~16 KB per pooled connection; set 4096 to restore the old footprint
mssql_utf8_supportBOOLEANtrueAdvertise TDS UTF8SUPPORT at login. A granting server sends UTF-8-collated columns without UTF-16 transcoding (measured half the wire bytes). Safe to request everywhere; exists to turn the request off
mssql_named_instance_resolutionBOOLEANtrueResolve Server=host\instance to the instance's dynamic port via SQL Server Browser (UDP 1434) at ATTACH. Set false where outbound UDP 1434 is stripped — a named instance then errors instead of silently using 1433
mssql_browser_timeout_secondsBIGINT3Browser UDP query timeout (ATTACH critical path; one retry)

Bulk Load (COPY / CTAS) Settings

Details: COPY TO and CTAS.

SettingTypeDefaultDescription
mssql_copy_flush_rowsBIGINT102400Rows per bulk-load batch — the batch boundary the server sees. 102 400 is SQL Server's own threshold for writing compressed columnstore rowgroups directly; smaller batches land in the delta store and never compress
mssql_copy_parallel_writersBIGINT0Concurrent bulk-load connections one COPY/CTAS may open. 0 derives from DuckDB threads (cap 8); 1 disables. Ignored inside explicit transactions (COPY pins one connection)
mssql_copy_tablockVARCHARautoauto | true | false. auto decides from the target's shape: heap ON, anything clustered OFF (the hint serialises parallel loaders against a clustered index)
mssql_ctas_use_bcpBOOLEANtrueCTAS transfers data over the bulk-load protocol (2–10× the text INSERT path)
mssql_ctas_text_typeVARCHARNVARCHARWhat an unannotated DuckDB VARCHAR becomes in created tables (NVARCHAR/VARCHAR); drives CTAS and COPY alike
mssql_ctas_drop_on_failureBOOLEANfalseDrop the created table when the load phase fails

Target Type Settings

Details: Target Column Types and Table Shape.

SettingTypeDefaultDescription
mssql_utf8_collationVARCHARLatin1_General_100_BIN2_UTF8Collation for created varchar columns when the server granted UTF8SUPPORT. BIN2 = binary comparison, case-/accent-sensitive; matches Fabric's default. Empty inherits the database default
mssql_default_string_lengthBIGINT0Length for unannotated VARCHAR columns created by CTAS/COPY (0 = MAX)
mssql_default_table_kindVARCHARHEAPShape of created tables: HEAP or COLUMNSTORE (clustered columnstore index created before the load)
mssql_catalog_native_typesBOOLEANtrueReport MSSQL_VARCHAR(n) / MSSQL_NVARCHAR(n) for bounded string columns of attached tables, so targets inherit declared lengths
mssql_convert_varchar_maxBOOLEANtrueConvert VARCHAR(MAX) to NVARCHAR(MAX) in catalog scan SQL for UTF-8 safety on non-UTF-8 collations

ORDER BY Pushdown Settings (Experimental)

SettingTypeDefaultRangeDescription
mssql_order_pushdownBOOLEANfalse-Enable ORDER BY pushdown to SQL Server

The order_pushdown ATTACH option provides per-database control. See ORDER BY Pushdown for details.

INSERT Settings

SettingTypeDefaultRangeDescription
mssql_insert_batch_sizeBIGINT1000≥1Rows per INSERT (SQL Server limit: 1000)
mssql_insert_max_rows_per_statementBIGINT1000≥1Hard cap on rows per INSERT
mssql_insert_max_sql_bytesBIGINT8388608≥1024Max SQL statement size (8MB)
mssql_insert_use_returning_outputBOOLEANtrue-Use OUTPUT INSERTED for RETURNING

UPDATE/DELETE Settings

SettingTypeDefaultRangeDescription
mssql_dml_batch_sizeBIGINT500≥1Rows per UPDATE/DELETE batch
mssql_dml_max_parametersBIGINT2000≥1Max parameters per statement (~2100 limit)
mssql_dml_use_preparedBOOLEANtrue-Use prepared statements for DML

Usage Examples

-- Increase connection pool for high-concurrency workloads
SET mssql_connection_limit = 20;

-- Reduce batch size for tables with large rows
SET mssql_insert_batch_size = 100;

-- Enable detailed statistics for query optimization
SET mssql_statistics_level = 2;

-- Disable connection caching for debugging
SET mssql_connection_cache = false;