Maximum capacity specifications for SQL Server - SQL Server (2024)

  • Article

Applies to: Maximum capacity specifications for SQL Server - SQL Server (1) SQL Server

This article shows maximum sizes and numbers of various objects defined in SQL Server 2016 (13.x) and later. If you want to view edition limits, see Compute capacity limits by edition of SQL Server.

For SQL Server 2014 (12.x), see Maximum capacity specifications for SQL Server 2014.

Database Engine objects

Maximum values of various objects defined in SQL Server databases, or referenced in Transact-SQL statements.

SQL Server Database Engine objectMaximumvaluesfor SQL Server (64-bit)Additional Information
Batch size65,536 * (network packet size)Network packet size is the size of the tabular data stream (TDS) packets used to communicate between the relational Database Engine and applications. The default packet size is 4 KB. Network packet size controls this configuration option.
Byte length of a string containing Transact-SQL statements (batch size)65,536 * (network packet size)Network packet size is the size of the tabular data stream (TDS) packets used to communicate between the relational Database Engine and applications. The default packet size is 4 KB, and is controlled by the network packet size configuration option.
Bytes per short string column8,000
Bytes per GROUP BY, ORDER BY8,060
Bytes per index key900 bytes for a clustered index. 1,700 bytes for a nonclustered index. For SQL Server 2014 (12.x) and earlier, all versions supported 900 bytes for all index types.The maximum number of bytes in a clustered index key can't exceed 900. For a nonclustered index key, the maximum is 1,700 bytes.

You can define a key using variable-length columns whose maximum sizes add up to more than the limit. However, the combined sizes of the data in those columns can never exceed the limit.

In a nonclustered index, you can include extra non-key columns, and they don't count against the size limit of the key. The non-key columns might help some queries perform better.

Bytes per index key for memory-optimized tables2,500 bytes for a nonclustered index. No limit for a hash index, as long as all index keys fit in-row.On a memory-optimized table, a nonclustered index can't have key columns whose maximum declared sizes exceed 2,500 bytes. It doesn't matter if the actual data in the key columns would be shorter than the maximum declared sizes.

For a hash index key, there's no hard limit on size.

For indexes on memory-optimized tables, there's no concept of included columns, since all indexes inherently cover all columns.

For a memory-optimized table, even though the row size is 8,060 bytes, some variable-length columns can be physically stored outside those 8,060 bytes. However, the maximum declared sizes of all key columns for all indexes on a table, plus any additional fixed-length columns in the table, must fit in the 8,060 bytes.

Bytes per foreign key900
Bytes per primary key900
Bytes per row8,060SQL Server supports row-overflow storage, which enables variable length columns to be pushed off-row. Only a 24-byte root is stored in the main record for variable length columns pushed out of row. For more information, see Large Row Support.
Bytes per row in memory-optimized tables8,060Memory-optimized tables on SQL Server 2016 (13.x) and later support off-row storage. Variable length columns are pushed off-row if the maximum sizes for all the columns in the table exceeds 8,060 bytes; this action is a compile-time decision. Only an 8-byte reference is stored in-row for columns stored off-row. For more information, see Table and Row Size in Memory-Optimized Tables.
Bytes in source text of a stored procedureLesser of batch size or 250 MB
Bytes per varchar(max), varbinary(max), xml, text, or image column2^31-1
Characters per ntext or nvarchar(max) column2^30-1
Clustered indexes per table1
Columns in GROUP BY, ORDER BYLimited only by number of bytes
Columns or expressions in a GROUP BY WITH CUBE or GROUP BY WITH ROLLUP statement10
Columns per index key32If the table contains one or more XML indexes, the clustering key of the user table is limited to 31 columns because the XML column is added to the clustering key of the primary XML index. You can include non-key columns in a nonclustered index, to avoid the limitation of a maximum of 32 key columns. For more information, see Create Indexes with Included Columns.
Columns per foreign key or primary key32
Columns per INSERT statement4,096
Columns per SELECT statement4,096
Columns per table1,024Tables that include sparse column sets include up to 30,000 columns. See sparse column sets.
Columns per UPDATE statement4,096Different limits apply to sparse column sets.
Columns per view1,024
Connections per clientMaximum value of configured connections
Database size524,272 terabytes
Databases per instance of SQL Server32,767
Filegroups per database32,767
Filegroups per database for memory-optimized data1
Files per database32,767
File size (data)16 terabytes
File size (log)2 terabytes
Data files for memory-optimized data per database4,096 in SQL Server 2014 (12.x). The limit is less strict on SQL Server 2016 (13.x) and later.
Delta file per data file for memory-optimized data1
Foreign key table references per tableOutgoing = 253.
Incoming = 10,000.
For restrictions, see Create Foreign Key Relationships.
Identifier length (in characters)128
Instances per computer50 instances on a stand-alone server.

25 failover cluster instances when using a shared cluster drive as storage.

50 failover cluster instances with SMB file shares as the storage option.

Indexes per memory-optimized table999 starting SQL Server 2017 (14.x) and in Azure SQL Database.

8 in SQL Server 2016 (13.x) and SQL Server 2014 (12.x).

Locks per connectionMaximum locks per server
Locks per instance of SQL ServerLimited only by memoryThis value is for static lock allocation. Dynamic locks are limited only by memory.
Nested stored procedure levels32If a stored procedure accesses more than 64 databases, or more than two databases in interleaving, you'll receive an error.
Nested subqueries32
Nested transactions4,294,967,296
Nested trigger levels32
Nonclustered indexes per table999
Number of distinct expressions in the GROUP BY clause when any of the following are present: CUBE, ROLLUP, GROUPING SETS, WITH CUBE, WITH ROLLUP32
Number of grouping sets generated by operators in the GROUP BY clause4,096
Parameters per stored procedure2,100
Parameters per user-defined function2,100
REFERENCES per table253
Rows per tableLimited by available storage
Tables per databaseLimited by total number of objects in a databaseObjects include tables, views, stored procedures, user-defined functions, triggers, rules, defaults, and constraints. The sum of the number of all objects in a database can't exceed 2,147,483,647.
Partitions per partitioned table or index15,000
Statistics on non-indexed columns30,000
Tables per SELECT statementLimited only by available resources
Triggers per tableLimited by number of objects in a databaseObjects include tables, views, stored procedures, user-defined functions, triggers, rules, defaults, and constraints. The sum of the number of all objects in a database can't exceed 2,147,483,647.
User connections32,767
XML indexes249

SQL Server Data-tier application objects

Maximum values of various objects that were tested in the SQL Server data-tier applications (DAC).

SQL Server DAC objectMaximumvaluesfor SQL Server (64-bit)Additional information
Databases per DAC1
Objects per DACLimited by the number of objects in a database, or available memory.Types of objects included in the limit are users, tables, views, stored procedures, user-defined functions, user-defined data type, database roles, schemas, and user-defined table types.

Replication objects

Maximum values of various objects defined in SQL Server Replication.

SQLServerReplication objectMaximumvaluesfor SQL Server
(64-bit)
Additional information
Articles (merge publication)2,048
Articles (snapshot or transactional publication)32,767
Columns in a table (merge publication)246If row tracking is used for conflict detection (the default), the base table can include a maximum of 1,024 columns. However, the publication needs to filter the article so that a maximum of 246 columns are published. If column tracking is used, the base table can include a maximum of 246 columns.
Columns in a table (SQL Server snapshot or transactional publication)1,000The base table can include the maximum number of columns allowable in the SQL Server publication database (1,024), but columns must be filtered from the article if they exceed the maximum specified for the publication type.
Columns in a table (Oracle snapshot or transactional publication)995The base table can include the maximum number of columns allowable in the SQL Server publication database (1,024), but columns must be filtered from the article if they exceed the maximum specified for the publication type.
Bytes for a column used in a row filter (merge publication)1,024
Bytes for a column used in a row filter (snapshot or transactional publication)8,000

See also

  • Hardware and software requirements for installing SQL Server
  • Check parameters for system configuration checker
  • Download SQL Server

Feedback

Submit and view feedback for

I'm an experienced database professional with in-depth knowledge of SQL Server and database management. I've worked with SQL Server extensively and have a strong understanding of various database concepts and configurations. Let's dive into the information provided in the article:

SQL Server Database Engine Object Maximum Values:

  1. Batch size: The batch size in SQL Server is determined by multiplying 65,536 by the network packet size. The default packet size is 4 KB. This configuration controls the size of TDS packets used for communication between the Database Engine and applications.

  2. Byte length of a string containing Transact-SQL statements (batch size): Similar to batch size, it's calculated as 65,536 times the network packet size. The default packet size is 4 KB.

  3. Bytes per short string column: The maximum size for short string columns is 8,000 bytes.

  4. Bytes per GROUP BY, ORDER BY: The limit for bytes per GROUP BY or ORDER BY clause is 8,060 bytes.

  5. Bytes per index key: For clustered indexes, it's 900 bytes, and for nonclustered indexes, it's 1,700 bytes. SQL Server 2014 (12.x) and earlier versions supported 900 bytes for all index types.

  6. Bytes per index key for memory-optimized tables: For nonclustered indexes on memory-optimized tables, the limit is 2,500 bytes, with no hard limit for hash indexes.

  7. Bytes per foreign key: The maximum size for a foreign key is 900 bytes.

  8. Bytes per primary key: The maximum size for a primary key is 900 bytes.

  9. Bytes per row: The maximum row size in SQL Server is 8,060 bytes. It supports row-overflow storage for variable-length columns.

  10. Bytes per row in memory-optimized tables: For memory-optimized tables, if the maximum size of all columns in a row exceeds 8,060 bytes, variable-length columns are pushed off-row.

  11. Bytes in source text of a stored procedure: Limited by the lesser of batch size or 250 MB.

  12. Bytes per varchar(max), varbinary(max), xml, text, or image column: Limited to 2^31-1 bytes.

  13. Characters per ntext or nvarchar(max) column: Limited to 2^30-1 characters.

  14. Clustered indexes per table: Limited to 1.

  15. Columns in GROUP BY, ORDER BY: Limited only by the number of bytes.

  16. Columns or expressions in a GROUP BY WITH CUBE or GROUP BY WITH ROLLUP statement: Limited to 10.

  17. Columns per index key: Limited to 32.

  18. Columns per foreign key or primary key: Limited to 32.

  19. Columns per INSERT statement: Limited to 4,096.

  20. Columns per SELECT statement: Limited to 4,096.

  21. Columns per table: Limited to 1,024, but tables with sparse column sets can include up to 30,000 columns.

  22. Columns per UPDATE statement: Different limits apply to sparse column sets.

  23. Columns per view: Limited to 1,024.

  24. Connections per client: The maximum value of configured connections.

  25. Database size: Up to 524,272 terabytes.

  26. Databases per instance of SQL Server: Limited to 32,767.

  27. Filegroups per database: Limited to 32,767.

  28. File size (data): Up to 16 terabytes.

  29. File size (log): Up to 2 terabytes.

  30. Data files for memory-optimized data per database: 4,096 in SQL Server 2014 (12.x), with a less strict limit on SQL Server 2016 (13.x) and later.

This list covers various aspects of SQL Server database limits, from batch sizes to connection limits, and provides valuable information for database administrators and developers. If you have any specific questions or need more details on any of these concepts, feel free to ask.

Maximum capacity specifications for SQL Server - SQL Server (2024)
Top Articles
Latest Posts
Article information

Author: Greg O'Connell

Last Updated:

Views: 6465

Rating: 4.1 / 5 (42 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Greg O'Connell

Birthday: 1992-01-10

Address: Suite 517 2436 Jefferey Pass, Shanitaside, UT 27519

Phone: +2614651609714

Job: Education Developer

Hobby: Cooking, Gambling, Pottery, Shooting, Baseball, Singing, Snowboarding

Introduction: My name is Greg O'Connell, I am a delightful, colorful, talented, kind, lively, modern, tender person who loves writing and wants to share my knowledge and understanding with you.