Database limits

This section describes the parameters of limits set in YDB.

Schema object limits

The table below shows the limits that apply to schema objects: tables, databases, and columns. The Object column specifies the type of schema object that the limit applies to.
The Error type column shows the status that the query ends with if an error occurs. For more information about statuses, see Error handling in the API.

ObjectLimitValueExplanationInternal
name
Error
type
DatabaseMaximum path depth32Maximum number of nested path elements (directories, tables).MaxDepthSCHEME_ERROR
DatabaseMaximum number of paths (schema objects)200,000Maximum number of path elements (directories, tables) in a database.MaxPathsGENERIC_ERROR
DatabaseMaximum number of tablets200,000Maximum number of tablets (table shards and system tablets) that can run in the database. An error is returned if a query to create, copy, or update a table exceeds this limit. When a database reaches the maximum number of tablets, no automatic table sharding takes place.MaxShardsGENERIC_ERROR
DatabaseMaximum object name length255Limits the number of characters in the name of a schema object, such as a directory or a tableMaxPathElementLengthSCHEME_ERROR
DatabaseMaximum ACL size10 KBMaximum total size of all access control rules that can be saved for the schema object in question.MaxAclBytesSizeGENERIC_ERROR
DirectoryMaximum number of objects100,000Maximum number of tables and child directories created in a directory.MaxChildrenInDirSCHEME_ERROR
TableMaximum number of table shards35,000Maximum number of table shards.MaxShardsInPathGENERIC_ERROR
TableMaximum number of columns200Limits the total number of columns in a table.MaxTableColumnsGENERIC_ERROR
TableMaximum column name length255Limits the number of characters in a column nameMaxTableColumnNameLengthGENERIC_ERROR
TableMaximum number of columns in a primary key20Each table must have a primary key. The number of columns in the primary key may not exceed this limit.MaxTableKeyColumnsGENERIC_ERROR
TableMaximum number of indexes20Maximum number of indexes other than the primary key index that can be created in a table.MaxTableIndicesGENERIC_ERROR
TableMaximum number of followers3Maximum number of read-only replicas that can be specified when creating a table with followers.MaxFollowersCountGENERIC_ERROR
TableMaximum number of tables to copy1000Limit on the size of the table list for persistent table copy operationsMaxConsistentCopyTargetsGENERIC_ERROR

Size limits for stored data

ParameterValueError type
Maximum total size of all columns in a primary key1 MBGENERIC_ERROR
Maximum size of a string column value8 MBGENERIC_ERROR

Limits that apply when executing queries

The table below lists the limits that apply to query execution. The Call column specifies the public API call that will end with the error status specified in the Status column.

ParameterValueCallExplanationStatus
in case of
a violation
of the limit
Maximum number of rows in query results1000ExecuteDataQueryComplete results of some queries executed using the ExecuteDataQuery method may contain more rows than allowed. In this case, a query will return the maximum number of rows allowed, and the result will have the truncated flag set.SUCCESS
Maximum query result size50 MBExecuteDataQueryComplete results of some queries may exceed the set limit. In this case, a query will fail returning no data.PRECONDITION_FAILED
Maximum number of sessions per cluster node1000CreateSessionUsing the library for working with YDB, an application can create sessions within a connection. Sessions are linked to a node. You can create a limited number of sessions with a single node.OVERLOADED
Maximum query text length10 KBExecuteDataQueryLimit on the length of YQL query text.BAD_REQUEST
Maximum size of parameter values50 MBExecuteDataQueryLimit on the total size of the parameters passed when executing a previously prepared query.BAD_REQUEST