You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
improvement(tables): cut the DB round trips a table read and write spend on protocol
The grid's first page spent more time on round trips than on work. Four of them
were avoidable:
- `pendingDeleteMask` probed `table_jobs` on every read, though the table a
request just loaded already carries its latest non-export job, and the
`one_active_per_table` unique index makes that row the running delete when one
exists. Callers that hold a table across a long walk (the export stream, the
snapshot builder) keep probing per page, so a delete starting mid-walk still
begins masking.
- The run-state sidecar was read for every table, including the ones that
declare no workflow group and therefore cannot have a row — four chunked
queries on a 1000-row page, all returning nothing.
- The drain opened a transaction per batch. The guards are fixed for the call,
so each extra batch paid `BEGIN` + `set_config` + `COMMIT` for nothing.
- `setTableTxTimeouts` issued three `SET LOCAL` statements; `set_config(…, true)`
is the same thing and fits in one round trip, as the read guards already do.
A 1000-row page goes from 22 statements to 14, a 50-row page from 15 to 13, and
every write transaction drops two.
0 commit comments