Database limits

This section describes the limit parameters set in YDB.

Schema object limits

The table below lists the limits of schema objects: tables, databases, and columns. The Object column shows the type of schema object to which the limit applies.
The Error type column shows the status with which the query will complete in case of an error. For more details on statuses, see the Error handling in the API section.

Object Limit Value Description Internal
name
Error
type
Error text
Database Maximum path depth 32 Maximum number of nested path elements (directories, tables). MaxDepth SCHEME_ERROR Paths depth limit exceeded
Database Maximum number of paths (objects in the schema) 10,000 Maximum number of path elements (directories, tables) in the database. MaxPaths PRECONDITION_FAILED Paths count limit exceeded
Database Maximum number of tablets 200,000 Maximum number of tablets (table shards and system tablets) that can run in the database. An error will be returned for a request to create, copy, or modify a table that could cause this limit to be exceeded. When the maximum number of tablets in the database is reached, automatic table sharding does not occur. MaxShards PRECONDITION_FAILED Shards count limit exceeded (in subdomain)
Database Maximum object name length 255 Limits the number of characters in the name of a schema object, such as a directory or table. MaxPathElementLength SCHEME_ERROR Path part is too long
Database Maximum ACL size 10 KB Maximum total size of all access control rules that can be stored for a single schema object. MaxAclBytesSize BAD_REQUEST ACL size limit exceeded
Directory Maximum number of objects 100,000 Maximum number of tables and directories created in a directory. MaxChildrenInDir PRECONDITION_FAILED Children count limit exceeded
Table Maximum number of table shards 35,000 Maximum number of table shards. MaxShardsInPath PRECONDITION_FAILED Shards count limit exceeded (in dir)
Table Maximum number of columns 200 Limits the total number of columns in a table. MaxTableColumns SCHEME_ERROR on creation / BAD_REQUEST on modification Too many columns
Table Maximum column name length 255 Limits the number of characters in a column name. MaxTableColumnNameLength SCHEME_ERROR Column name too long
Table Maximum number of columns in the primary key 20 Each table must have a primary key. The number of columns that make up the primary key cannot exceed this limit. MaxTableKeyColumns SCHEME_ERROR Too many key columns
Table Maximum number of indexes 20 Maximum number of indexes, in addition to the primary key index, that can be created on a table. MaxTableIndices PRECONDITION_FAILED Indexes count has reached maximum value in the table
Table Maximum number of replicas 3 Maximum number of read-only replicas that can be specified when creating a table with replicas. MaxFollowersCount BAD_REQUEST Too much followers
Table Maximum number of tables to copy 10,000 Limit on the size of the table list for consistent table copy operations. MaxConsistentCopyTargets BAD_REQUEST Consistent copy object count limit exceeded

Stored data size limits

Parameter Value Error type
Maximum total size of all columns in the primary key 1 MB GENERIC_ERROR
Maximum size of a string column value 16 MB GENERIC_ERROR

Analytical table limits

Parameter Value
Maximum row size 8 MB
Maximum size of an inserted data block 8 MB

Query execution limits

The table below lists the limits that apply when executing queries.

Parameter Value Description Effect
in case
of limit
violation
Query duration 2 hours Maximum time to execute a single query. TIMEOUT
Maximum number of sessions per cluster node 1000 Limit on the number of sessions a client can create with each YDB node. OVERLOADED
Maximum query text length 10 KB Limit on the length of YQL query text. BAD_REQUEST
Maximum size of parameter values 50 MB Limit on the total size of parameters passed when executing a parameterized query. BAD_REQUEST
Maximum row size 50 MB Limit on the total size of all fields in a single row returned or generated by a query. PRECONDITION_FAILED
Maximum number of locks per DataShard 10000 Number of optimistically locked key ranges on each DataShard Some locks are converted to full-shard locks (they use less memory but lock the entire shard instead of a part of it).
Deprecated limits

In previous versions of YDB, queries were executed using an API called “Table Service”. This API had the following limitations, which were eliminated when switching to the new API called “Query Service”.

Parameter

Value

Explanation

Status on limit violation

Maximum number of rows in query result

1000

Full results of some queries executed via the ExecuteDataQuery method may contain more rows than allowed. In this case, the maximum allowed number of rows will be returned in response to the query, and the result will have the truncated flag set.

SUCCESS

Maximum size of query result

50 MB

The full result of some queries may exceed the set limit. In this case, the query will fail with an error and no data will be returned.

PRECONDITION_FAILED

Resource pool limits

Parameter Value
Maximum number of resource pool classifiers 1000

Limits on the number of resources are imposed by limits on the number of schema objects. These limits can be found above.