Skip to content

perf(data-grid): read large text, JSON and binary cells as a head and a size - #4603

Merged
datlechin merged 10 commits into
mainfrom
perf/large-cells-head-length
Nov 27, 2026
Merged

datlechin merged 10 commits into
mainfrom
perf/large-cells-head-length

Conversation

@datlechin

@datlechin datlechin commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • A table page on PostgreSQL, MySQL, MariaDB and SQLite now reads a large text, JSON, jsonb or XML value as its first 256 characters plus its byte length, and a large binary value as its length alone. The full value is read by primary key when the cell is opened, copied, edited or exported, as perf(data-grid): load large MySQL binary values only when a cell needs them #3758 does for MySQL BLOBs.
  • A cut cell holds NULL in the row, as perf(data-grid): load large MySQL binary values only when a cell needs them #3758's do, so every reader of row values keeps its existing handling. The first characters live beside the row in TableRows, and only the grid, its column sizing and the AI chat summary show them. A masked column keeps none and shows the size.
  • Each engine declares its size and head functions as LargeValueFunctions in its curated metadata, replacing binaryLengthFunction. KingbaseES keeps reading every value whole.
  • A column that can never pass the limit stays a plain column: a declared size such as varchar(255), and MySQL's TINYTEXT, TEXT, TINYBLOB and BLOB. SQLite does not enforce declared sizes, so there a varchar(n) is deferred too.
  • On PostgreSQL a jsonb, json or xml value is cut or kept by its stored size where that settles it, so most never have their text built; only one stored between an eighth of the limit and the limit is measured as text.
  • The fold cuts the size and head columns off each row in place instead of copying every row. It gives a deferred column the table's origin, since engines report none for the CASE expression; without one, external masking hid the whole column.
  • Find offers Search All Rows when the page holds cut values, since it cannot see past their first characters. A row dragged out names a value left on the server instead of dropping it as NULL.
  • The connection editor's Binary Value Limit is now Large Value Limit.
  • A key that a value read gets back on two rows is left out, and that cell reports it could not be read. A PostgreSQL parent's key is not unique across its inheritance children, which the page reads too, so a reload by key could hand one row another row's value.
  • SQLite defers a table's values only when every key column is typed with INT, CHAR, CLOB or TEXT. A key without that affinity can hold 1 and '1' as two keys that both read back as 1. A REAL key's text can round.
  • On SQLite a row whose key is NULL keeps its values in the page, since a NULL key cannot be read back.
  • A page defers columns only while its size and head columns keep the result under 1,600 columns. PostgreSQL refuses more than 1,664 and SQLite more than 2,000.
  • Docs: docs(features): large text, JSON and binary values on four engines docs#298 (draft).

Left for later, posted on #4525: query tabs, SQLite readValues on macOS, and the head and cut flag in the columnar store (#4521).

Test plan

  • UnloadedValuePlanTests: the select list per engine (MySQL text, PostgreSQL text, jsonb and bytea, SQLite text), which types are deferred, declared and bounded sizes, the fold keeping heads and the table's types, deferred origins.
  • TableRowsUnloadedValueTests: a cut text reads NULL with its head kept beside the row, a load drops the head, a masked column keeps none, and the grid shows the head with an ellipsis.
  • UnloadedValueWriteTests: an edit next to a cut text writes only the edited column by key, and the load completes the pre-image of an update and of a delete.
  • UnloadedValueFirstLoadTests, GridFindEngineTests, DataGridResponderCommandTests: the PostgreSQL first page, Replace leaving a cut value alone, the row drag.
  • Changed on purpose: ConnectionEditorEngineIssueTests, UnloadedValueFirstLoadTests/otherEngineReadsInline, DefaultSortInitialQueryTests/firstLoadSchemaWaitDecision and FilterTypingBeforeFirstLoadTests/appliedFiltersNeedTheSchema used PostgreSQL as the engine without deferral. They use SQL Server now. The last two were the red macOS Tests run. UnloadedValuePlanTests/sqliteProjection pins the SQLite select list with its NULL-key guard.
  • New: sharedKeyIsLeftOut, rowReadInTwoStatementsKeepsItsValue, sqliteCompositeKeyGuard, sqliteLooseKeyNoPlan, sqliteExactKeyDefers, wideTableStaysUnderTheColumnLimit, enforcedKeysNeedNoGuard.
  • Ran these with UnloadedValueReaderTests, UnloadedValueLoadTests, UnloadedValueExportTests, ColumnCatalogLoadTests, TableRowsSparseStateTests, DataGridEditingTests, InlineEditEligibilityTests, MaskingGridTests, MaskingExportTests, SaveAttributionTests and GridDatasetFindTests: all pass.
  • No screenshots yet: the Mac was in use during this run. Owed: the connection editor's Large Value Limit and a grid with cut cells, light and dark.
  • Reviewed by independent Claude reviewers, each given only the diff and the issue, since the Codex reviewer was at its usage limit. Codex then ran two rounds on the merge with main. Round 1 found the shared PostgreSQL key and the NULL SQLite key. Round 2 found the SQLite key affinity and the column limit. All four are fixed above.
  • verify.sh --jobs 4 on the fixed head merged with main: build PASS, l10n PASS, test over the 16 suites above plus DefaultSortInitialQueryTests, FilterTypingBeforeFirstLoadTests and DataGridDisplayCacheTests: 189 executed, 188 passed. The one failure was the new enforcedKeysNeedNoGuard, which asked MySQL to defer a text column at the default limit, where MySQL's TEXT never needs it; fixed, UnloadedValuePlanTests 27 of 27.
  • After the last merge with main (perf(results): run the adapter's side of every driver call off the main actor #4595 touched QueryExecutor.swift): build PASS; test over the unloaded-value suites, the two first-load suites and QueryExecutorTests: 141 executed, 141 passed.
  • Not measured on a live server yet: bytes per page, phys_footprint and first paint for the issue's big_cells tables.
  • Known server cost to measure there: each size test appears in the value, size and head expressions, and neither engine shares it. A MySQL JSON value, and a PostgreSQL jsonb stored between an eighth of the limit and the limit, is turned into text for each one; a cut one is turned into text twice more, for its size and head. A jsonb compressed past an eighth of its text size is read whole.

Closes #4525

… a size

A table page on PostgreSQL, MySQL, MariaDB and SQLite reads a large text, JSON, jsonb or XML value as its first 256 characters and its byte length, and a large binary value as its length. The cell holds NULL as #3758's do; the first characters live beside the row for the grid. The full value loads by key when the cell is opened, copied, edited or exported.
@datlechin
datlechin merged commit 3fd812b into main Nov 27, 2026
11 of 12 checks passed
@datlechin
datlechin deleted the perf/large-cells-head-length branch November 27, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(results): read large text, json and blob cells as a head and a length

1 participant