oliver-zehentleitner / maity

hub: render_all's cleanup decides a candidate with a keyed read, not the full target list

Sign in to report

tsk-ay4htr4s4w88 Done An agent

Taken from the hub roll-up tsk-b7mtzr8xybp5 (nte-3mb11h178avx) as its own card, by the lead's decision (lotse 100326): perf work, not P3 size.

From #1509 (merged 96c85ea3, tsk-b7mtzr8xybp5 part 2), P3 from maity-review-team-chatgpt#fmzu (review 93883): render_all's cleanup decides each candidate in its own transaction and re-reads the full target list (kind.targets(conn)) for each. So a pass costs about C full target reads (C candidates, T targets each, about C×T id materialisations). These are live target tables, not history, so it is cheap without an orphan backlog. A large backlog, though (for example many public cards removed while the hub was down), makes it expensive.

Boundary:

  • Each candidate is decided by a keyed eligibility read for that one candidate, not by enumerating every target again.
  • Same outcome as today, each decision in its own transaction.
  • A red/green test that counts the statements (or rows read) of a pass with C candidates and T targets: today it grows with C×T, afterwards with C.
  • Check the current code on main first; #1509's shape may have changed since.