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
{{ message }}
Repository navigation
driver-sql: measure id = ANY(ARRAY(SELECT …)) against the share-grant semi-join for a caller with no grant on PostgreSQL (ADR-0155 step 6 cost) #36034
Filing gate: ② a measured cost the switch ships with · Source: fleet (#33787 step 6 dev report, open_questions[2]; seat 7's call 2026-11-21T09:20Z: "ship it with the cost stated … and file the ANY(ARRAY()) follow-up card"). Part of #33787.
这一步做什么:在同样的数据上实测另一种写法 id = ANY(ARRAY(SELECT …)),看它能不能让总数查询回到索引、同时结果行完全不变(D-0)。
不做会怎样:大表上无共享用户的列表总数慢几倍(毫秒级),结果正确。
要你做的:看实测结果后再决定换不换写法(step 3 的 L2 已把这个写法列为你来权衡的选项)。
What is known
Step 6 measured, for a caller holding no grant, the list page of 50 and its total (medians of 25 runs). PG16 100k: page 1.59 → 1.72 ms (pkey index scan both), total 1.46 → 7.29 ms; the owner-index Bitmap becomes a Seq Scan with a hashed SubPlan. PG16 1M: page 1.65 → 1.58 ms, total 7.88 → 42.21 ms (Parallel Seq Scan). SQLite 100k and 1M keep the owner index (MULTI-INDEX OR).
The statement is ADR-0155 D2's: id IN (SELECT record_id FROM sys_record_share WHERE object_name=? AND recipient_type='user' AND recipient_id=? AND record_id IS NOT NULL AND record_id <> ''), with D2's "⛔ No EXISTS, no correlated form, no join". id = ANY(ARRAY(SELECT …)) is uncorrelated and was named by step 3's L2 as a form for the maintainer to weigh. Whether it is inside D2's text is part of this card's question.
Scope
Measure on PG16 at 100k and 1M: today's semi-join vs ANY(ARRAY(…)) for the no-grant caller (page and total) and for 5,000 / 6,000 grants. Plans and medians.
Triage: lands in domain:server (driver-sql, PostgreSQL) · pm:queue; rationale: area:data · Task · after ADR-0155 step 6, the list total for a caller with no share grant leaves the owner index on PostgreSQL (100k rows 1.46 → 7.29 ms, 1M rows 7.88 → 42.21 ms; the page itself and SQLite are unaffected); measure id = ANY(ARRAY(SELECT …)) as an index-friendly form with identical rows (D-0); part of #33787 → p3 as filed (a measured, bounded cost; kept, not closed) · size S.
Activity
objectstack-fleet commentedon Nov 21, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Triage: lands in
domain:server(driver-sql, PostgreSQL) ·pm:queue; rationale: area:data · Task · after ADR-0155 step 6, the list total for a caller with no share grant leaves the owner index on PostgreSQL (100k rows 1.46 → 7.29 ms, 1M rows 7.88 → 42.21 ms; the page itself and SQLite are unaffected); measureid = ANY(ARRAY(SELECT …))as an index-friendly form with identical rows (D-0); part of #33787 → p3 as filed (a measured, bounded cost; kept, not closed) · size S.fix(plugin-sharing)!: every share grant counts; the sharing scopes ca…