SQL Server / Azure SQL

SQL Server is a relational DBMS developed by Microsoft. It runs on Windows and Linux, and the same database engine is also offered as a managed service on Azure (Azure SQL). Where an article's table says "Azure SQL", the cell applies to the SQL Server engine as well. The sandbox on this site uses SQL Server 2022 Developer edition. The SQLOS schedulers and memory regions are covered in Memory and Thread Architecture, and sessions, plan cache, and cursors in Connections, Cursors, and Plan Cache.

Key Specs

ItemValue
Storage unit8KB page (fixed). Eight pages make one extent (64KB)
FilesData files (.mdf, .ndf), transaction log file (.ldf)
Table storageHeap or clustered index. Creating a primary key makes it clustered by default
What a secondary index points toThe clustering key for a clustered table, the row address (RID) for a heap
Maximum row size8,060 bytes of in-row data. Variable-length columns beyond that go to row overflow
Buffer poolBuffer pool, capped by max server memory
Large value handlingvarchar(max), nvarchar(max), varbinary(max): LOB pages
Concurrency controlLocking by default. With snapshot isolation or READ_COMMITTED_SNAPSHOT enabled, row versions (version store)
Default isolation levelRead Committed. In Azure SQL Database, READ_COMMITTED_SNAPSHOT is on by default
Operating system cacheBypassed. Data and log files are read and written unbuffered

Product Lineup

NameFormTraits
SQL ServerSelf-installedEnterprise, Standard, Express (free, 10GB per database), Developer (free, development and test only)
Azure SQL DatabasePer-database PaaSAlways the latest engine with no version concept. Memory and CPU are set by service tier and vCore count
Azure SQL Managed InstancePer-instance PaaSSupports most instance features, such as SQL Server Agent and cross-database queries
SQL Server on Azure VMIaaSSQL Server installed directly on a virtual machine

Old Values and the Version Store

In the default configuration, UPDATE changes the value in place and leaves the old value only in the transaction log. Readers wait on locks. When you turn on ALTER DATABASE ... SET READ_COMMITTED_SNAPSHOT ON or ALLOW_SNAPSHOT_ISOLATION ON, the old row version is copied to the version store in tempdb, and readers read that version without waiting. From 2019, with Accelerated Database Recovery (ADR) turned on, versions are kept in a persistent version store (PVS) inside the user database.

Configuration and Checks

SELECT @@VERSION;
SELECT SERVERPROPERTY('Edition') AS edition, SERVERPROPERTY('EngineEdition') AS engine_edition;
SELECT name, is_read_committed_snapshot_on, snapshot_isolation_state_desc FROM sys.databases;
SELECT name, type_desc, size * 8 / 1024 AS size_mb FROM sys.database_files;

Comparison with Other DBMSs

  • You can choose a heap or a clustered index for each table. PostgreSQL uses only heaps, and MySQL (InnoDB) uses only clustered tables.
  • Most DDL can be rolled back inside a transaction.
  • It is the only DBMS whose page size cannot be changed (fixed at 8KB).

In the Articles

NOTE Limits by edition and Azure defaults can vary with the version and service tier.

Related pages