When an asynchronous result switched to JSON, every BLOB, non-finite number or
malformed UTF-8 cell scanned the remaining column names to check whether a
later column with the same name would overwrite it. A result with 256 rows and
2,000 BLOB columns made about 512 million name comparisons.
The builder now records, once per result and next to the JSON keys, whether
each column is the last one with its name. The last column still wins,
including when an earlier column holds a BLOB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Codex <noreply@openai.com>
When an asynchronous query result switches to JSON, each BLOB, non-finite number or malformed UTF-8 cell is patched in afterwards. Before patching, the builder scanned every later column name to check whether a column with the same name would overwrite the cell. That makes wide results quadratic in the column count: 256 rows with 2,000 BLOB columns do about 512 million name comparisons.
The builder now records once per result, next to the JSON keys, whether each column is the last one with its name, and
appendPatch()reads that flag. The last column still wins, including over an earlier BLOB, which a new host test covers. On an M5 Pro, building that 2,000-column BLOB result drops from a median of 955 ms to 28 ms.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes