SQL Server configuration settings
Three layers: instance options in sp_configure, per-database options in ALTER DATABASE ... SET, and per-database optimizer switches in ALTER DATABASE SCOPED CONFIGURATION. Most are dynamic after RECONFIGURE; sys.configurations.is_dynamic says which are not.
Inspect what your server runs with
SELECT name, value, value_in_use, minimum, maximum, is_dynamic, is_advanced FROM sys.configurations WHERE value <> value_in_use OR name LIKE '%memory%'; SELECT name, value FROM sys.database_scoped_configurations WHERE is_value_default = 0;
No setting matched. Try a topic such as memory, log or timeout.
メモリ
Caches, per-query work memory and the ceiling on what the server takes from the OS.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
max server memory (MB) |
2147483647 |
いいえ | Upper limit on the memory SQL Server's memory manager takes, buffer pool included. |
min server memory (MB) |
0 |
いいえ | Memory SQL Server will not release back to the OS once it has acquired it. |
min memory per query (KB) |
1024 |
いいえ | Smallest memory grant a query that sorts or hashes receives. |
optimize for ad hoc workloads |
0 (off) |
いいえ | Cache only a small plan stub the first time an ad hoc batch runs. |
接続
How many sessions the server accepts and what each one costs.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
user connections |
0 (= 32767) |
はい | Maximum simultaneous user connections; 0 means the maximum, 32767. |
Parallelism & workers
Worker pools and how many CPUs one query may use.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
max worker threads |
0 (auto) |
いいえ | Size of the worker thread pool; 0 sizes it from the CPU count. |
max degree of parallelism |
0 |
いいえ | Most schedulers one parallel query operator may use; 0 means all. |
cost threshold for parallelism |
5 |
いいえ | Estimated plan cost above which the optimizer considers a parallel plan. |
MAXDOP |
0 |
いいえ | Per-database MAXDOP that overrides the instance setting for queries in this database. |
WAL, redo & durability
What a COMMIT waits for and how the change log is sized and written.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
RECOVERY |
Inherited from model |
いいえ | Recovery model: whether the transaction log is kept for log backups (FULL, BULK_LOGGED) or truncated at checkpoints (SIMPLE). |
DELAYED_DURABILITY |
DISABLED |
いいえ | Let commits return before their log records are hardened to disk. |
backup checksum default |
0 |
いいえ | Verify page checksums and add a backup checksum on every BACKUP by default. |
Checkpoints & recovery
How often dirty pages are flushed and how long crash recovery may take.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
TARGET_RECOVERY_TIME |
60 SECONDS |
いいえ | Target crash-recovery time for a database, which switches it to indirect checkpoints. |
recovery interval (min) |
0 |
いいえ | Target recovery time for automatic checkpoints, used only by databases with TARGET_RECOVERY_TIME = 0. |
ACCELERATED_DATABASE_RECOVERY |
OFF |
いいえ | Accelerated database recovery (ADR): near-instant rollback and crash recovery using a persistent version store. |
Disk I/O
Flush rates, I/O threads and how the engine talks to the file system.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
FILEGROWTH |
64MB |
いいえ | How much a data or log file grows each time it fills. |
backup compression default |
0 |
いいえ | Compress backups unless the BACKUP statement says otherwise. |
Vacuum, statistics & maintenance
Background cleanup and the statistics the planner relies on.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
AUTO_UPDATE_STATISTICS |
ON |
いいえ | Update statistics automatically when enough rows have changed. |
AUTO_UPDATE_STATISTICS_ASYNC |
OFF |
いいえ | Let a query compile with existing statistics while the update runs in the background. |
AUTO_SHRINK |
OFF |
いいえ | Periodically shrink data and log files with free space. |
Query planner
Cost model and plan-shape switches.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
COMPATIBILITY_LEVEL |
170 |
いいえ | Which version's query optimizer and T-SQL behavior a database uses. |
LEGACY_CARDINALITY_ESTIMATION |
OFF |
いいえ | Use the pre-2014 cardinality estimator in this database regardless of compatibility level. |
PARAMETER_SNIFFING |
ON |
いいえ | Whether plans are compiled for the parameter values of the first execution. |
QUERY_OPTIMIZER_HOTFIXES |
OFF |
いいえ | Enable optimizer fixes shipped in cumulative updates, which are off by default. |
Timeouts
Limits on statements, lock waits and idle sessions.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
LOCK_TIMEOUT |
-1 (wait forever) |
いいえ | Milliseconds a statement waits for a lock before failing with error 1222; -1 waits forever. |
remote query timeout (s) |
600 |
いいえ | Seconds an outgoing linked-server query may run before it times out; 0 waits forever. |
query governor cost limit |
0 (off) |
いいえ | Refuse to run queries whose estimated cost exceeds this; 0 disables. |
Logging & diagnostics
What gets logged and which runtime statistics are collected.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
QUERY_STORE |
ON (READ_WRITE) |
いいえ | Query Store: per-database history of query plans and runtime statistics. |
blocked process threshold (s) |
0 (off) |
いいえ | Seconds a task must be blocked before a blocked process report event fires; 0 disables. |
Temporary storage
Internal temporary tables, tempdb and spill space.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
tempdb data files |
Number of cores, up to 8 |
いいえ | Number of tempdb data files, which spreads allocation-page contention. |
tempdb metadata memory-optimized |
0 |
はい | Keep tempdb system tables in memory-optimized tables to remove metadata contention. |
SQL behavior
Settings that change query results or locking semantics, not just speed.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
READ_COMMITTED_SNAPSHOT |
OFF |
いいえ | Make READ COMMITTED use row versions instead of shared locks. |
ALLOW_SNAPSHOT_ISOLATION |
OFF |
いいえ | Allow transactions to use SNAPSHOT isolation. |
Security & access
Network exposure and features that widen the attack surface.
| 設定 | デフォルト | Restart | 何ができるか |
|---|---|---|---|
remote admin connections |
0 |
いいえ | Allow the dedicated administrator connection (DAC) from other machines. |
xp_cmdshell |
0 (disabled) |
いいえ | Allow T-SQL to run operating system commands through xp_cmdshell. |
clr enabled |
0 |
いいえ | Allow user CLR assemblies to run. |
contained database authentication |
0 |
いいえ | Allow contained databases with their own users and passwords. |
SQL Server configuration FAQ
What does show advanced options do?
Most performance options are marked advanced and are hidden from sp_configure, and refused, until you run EXEC sp_configure 'show advanced options', 1; RECONFIGURE;. It changes nothing else.
What is the difference between value and value_in_use?
value is what sp_configure last set; value_in_use is what the engine is running with. They differ after sp_configure without RECONFIGURE, or for non-dynamic options until the service restarts.
When do I use a database scoped configuration instead of sp_configure?
Scoped configurations (MAXDOP, LEGACY_CARDINALITY_ESTIMATION, PARAMETER_SNIFFING and others) apply to one database and override the instance setting there. They are the only option on Azure SQL Database, and they travel with the database in an availability group.
The full list is in the SQL Server manual. Other engines: PostgreSQL, MySQL, Oracle, SQLite.
Related on SQLly
Run these queries against your own server
SQLly connects to SQL Server and the other engines in this reference from one desktop app on macOS, Windows and Linux, with a results grid you can sort, filter and export.