Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions reference/operations-api/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,35 @@ Returns the definition of a specific table.
{ "operation": "describe_table", "table": "dog", "database": "dev" }
```

Alongside the schema, the response carries the size of the table's **record-structure dictionaries**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to the repository's general rules, when documenting behavior changes to an existing surface (such as adding new fields to the describe_table response), we should use the <VersionBadge type="changed" version="vX.Y.0" /> format. Please add the appropriate version badge to indicate this change.

Suggested change
Alongside the schema, the response carries the size of the table's **record-structure dictionaries**
Alongside the schema, the response carries the size of the table's **record-structure dictionaries** <VersionBadge type="changed" version="v5.3.0" />
References
  1. Use the <VersionBadge type="changed" version="vX.Y.0" /> format when documenting behavior changes to existing surface, as prescribed in the repository's guidelines.

— the physical record layouts Harper has seen for this table:

| Field | Description |
| -------------------------- | ------------------------------------------------------------------------------------ |
| `typed_structures_enabled` | Whether random-access (typed) encoding is enabled for this table |
| `typed_structure_count` | Structures in the random-access dictionary |
| `typed_structure_limit` | Bound past which novel record shapes are stored without random-access field encoding |
| `classic_structure_count` | Structures in the classic named-record dictionary |

A structure is minted per distinct _shape_, where shape means the ordered list of fields plus each
field's value width class — so `{a, b}` and `{b, a}` are different shapes, and so are `{v: 1}` and
`{v: 70000}`. Dictionary size therefore tracks the variety of shapes a table has ever written, not
its column count, and it only grows: structures are never pruned, because stored records,
transaction-log entries, and replication backlogs all reference them by id.

`storage.randomAccessFields` defaults to off, so `typed_structures_enabled: false` with
`typed_structure_count: 0` is the normal state for most tables — that is typed encoding being
disabled, not spare headroom. Where it is enabled, reaching `typed_structure_limit` is not an error:
records with novel shapes past that point still write and read correctly, but are stored without
random-access field encoding, which makes reading individual fields of large records slower. Harper
logs a warning when a thread first observes the bound, but that depends on which thread served the
writes and whether it has loaded the dictionary — the counts here are the reliable signal.

To keep the dictionary small, write records in a consistent field order, avoid making the _set_ of
present fields vary per write (nest volatile or optional fields inside one sub-object rather than
adding and removing top-level fields), and expect a small fixed number of extra shapes from numeric
fields whose values cross a width boundary.

### `create_database`

Creates a new database.
Expand Down