- Docs
- Reference
Limits
v3.0.0
Every numeric limit and cap in KDBS, with its default, its config key, and what happens when it is reached.
In this article
KDBS has two kinds of limits: fixed limits built into the engine, and caps you set in the server config. A cap never silently truncates a result. Depending on the cap, the statement fails, the work falls back to a slower path that gives the same answer, or a value is not cached.
Identifiers and keys
| Limit | Value | Config key | When exceeded |
|---|
| Primary-key id space, per table | [1, 2^48 - 1] = 1 to 281474976710655 | none | A supplied key outside the range is refused OutOfRange with its byte position. When a table’s id space is used up, inserts are refused OutOfRange; ids never wrap. SHOW BUDGET warns at 90% used. |
| Issued-key redraws | 8 | none | An issued key that meets a concurrently supplied key 8 times in a row is refused AlreadyExists. |
| Primary-key column type | an integer type | none | Any other type is refused at CREATE TABLE. The id is stored in 48 bits whatever the declared width. |
| Cores | 1 to 64, and not more than the machine reports | cores | The server refuses to start. |
| User columns, whole instance | about 7,800 | none | CREATE TABLE is refused once the catalog’s reserved page range is full. DROP TABLE frees its column rows. |
Rows per statement
| Limit | Default | Config key | When exceeded |
|---|
Rows in one INSERT ... VALUES | 1024 | max_insert_rows (at least 1) | The whole statement is refused and nothing is inserted: ERR INSERT of <n> rows exceeds max_insert_rows (<cap>). |
| Rows one statement may read | 100,000,000 | max_rows_touched (0 = unlimited) | The statement is refused ResourceExhausted, not retryable. Also bounds SHOW RELAYOUT <table>’s page census. |
Rows one ORDER BY may hold | 1,048,576 | sort_max_rows | The statement fails, naming the key. There is no spill to disk and no partial result. A LIMIT caps what is held at offset + limit. ORDER BY <primary key> ascending needs no sort and is never limited. |
| Groups in one aggregated statement | 65,536 | aggregate_max_groups | The statement fails, naming the key. Nothing is returned. |
DISTINCT entries in one statement, summed over its sets | 1,048,576 | aggregate_max_distinct | The statement fails, naming the key. |
| Rows in a join’s in-memory build | 65,536 | join_build_max_rows (0 = no build) | No error. The join falls back to per-row walks for the rest of the statement, with the same answer. |
| Lock-table entries per transaction | 65,536 | max_locks_per_txn | The statement is refused ResourceExhausted, not retryable. Use shorter transactions, or write by primary-key range, which takes one entry for the range. |
Query shape
| Limit | Value | When exceeded |
|---|
ORDER BY keys | 8 | NOT_IMPLEMENTED with the byte position. |
| Subquery nesting below the outer query | 4 levels | The fifth level is refused with its byte position. |
| Scalar subquery result | 1 row | CardinalityViolation at run time, not retryable. |
GROUP BY columns in an assertion | no cap | |
Values and columns
| Limit | Value | When exceeded |
|---|
| Largest single value | 8144 bytes (one var-heap page) | NotImplemented. |
varchar cell width | inline_cell_width, default 64, range 16 to 4096 | A value longer than width − 3 bytes is stored out of line; it is not refused below 8144 bytes. |
varchar(N) | 16 ≤ N ≤ 4096 | N is a cell width, not a maximum length. |
char(N) | N bytes | A longer value is refused. A value containing a NUL byte is refused. |
decimal(p, s) | p ≤ 38; up to 18 is stored in 8 bytes, 19 to 38 in 16 bytes | Precision and scale are both required. |
SUM | checked int64 | Overflow fails the statement; it never wraps. |
UPDATE arithmetic | checked in the result type | A result out of range is OutOfRange at that row; division by zero is InvalidArgument. |
Indexes, Cabins and assertions
| Limit | Default | Config key | When exceeded |
|---|
| Index key columns | 4 | none | NOT_IMPLEMENTED with the byte of the extra column. |
| Index covered columns | 8 | none | Refused with the byte of the extra column. |
| Cabin columns | 1 per Cabin | none | A second column is refused. |
| Distinct values one Cabin observes | 4096 | cabin_max_values (0 = observe nothing) | The value is not observed and is served by a scan. Results are unchanged. |
| Entries per value in one Cabin | 4096 | cabin_max_entries_per_value | Same as above. |
| Pages for optimizer-managed Cabins | 1024 | cabin_optimizer_page_budget | The optimizer keeps the Cabins it manages within this budget. |
| Assertion bound | a non-negative integer literal | none | A negative or non-literal bound is refused. COUNT(*) <= 0 and < 1 are refused. |
Time limits
| Limit | Default | Config key | When exceeded |
|---|
| Explicit transaction lifetime | 60,000 ms | txn_lifetime_ceiling_ms (0 refused) | The server rolls the transaction back. The next statement, COMMIT included, is refused RESOURCE_EXHAUSTED until the client sends ROLLBACK. Checked every quarter of the ceiling, so the rollback comes between 1× and 1.25× of it. Autocommit statements and bulk-load sessions are exempt. A running statement is never interrupted. |
| Wait before a lock wait is a fault | 1000 ms | lock_wait_fault_net_ms (0 = refuse at once) | The waiting statement is aborted, never the holder, and the fault is logged. A normal wait ends earlier, when the holder commits or rolls back. |
PURGE waiting for older readers | 1 s | none | Refused TXN_CONFLICT retryable=1; nothing is purged. |
relaxed commit loss window | 10,000 µs | relaxed_flush_interval_us | Not an error; the commit is synced. |
| WAL drain cadence | 1000 µs | wal_drain_interval_us | Not an error. |
| Checkpoint cadence | 5000 ms | checkpoint_interval_ms | Not an error. |
| TCP keepalive idle | 60 s, at most 32767 | tcp_keepalive_s | A vanished client, or one that leaves a reply unread, is closed after about twice this. |
| Idle open backup | 1 hour | none | The backup is aborted. |
Memory and storage
| Limit | Default | Config key | When exceeded |
|---|
| Buffer pool | required, no default | buffer_pool_frames (8 KiB frames) | A statement that needs more frames than the pool can free is refused ResourceExhausted. Below the floor (resident system and Bound Cabin pages plus 256 frames), the server refuses to mount. |
| WAL segment size | 64 MiB | none (fixed per volume) | |
| WAL archive fail-closed threshold | 4 segments (256 MiB) free on the WAL filesystem | none | While archiving is failing, every statement that writes the log is refused. Reads continue. |
| Backup copy rate | up to 256 MiB/s | none | |
Protocol (KWP/1)
| Limit | Value | When exceeded |
|---|
| Named statements per session | 64 | RESOURCE_EXHAUSTED, not retryable. |
| Portals per session | 64 | RESOURCE_EXHAUSTED, not retryable. |
| Frame length a client should accept | 4 bytes to 16 MiB | Clients should refuse a frame length outside this range. |
Related pages