fix(supabase): V1-2.1 walk the document's numbers in linear time

jsonb_path_query row by row is quadratic on PostgreSQL 17: a document of
200k numbers under the cap ran into the statement timeout. One
jsonb_path_query_array call, then its elements. pgTAP 017 saves 600 000
numbers; the perf suite times 600k (saved) and 1M (closed code) over HTTP.
This commit is contained in:
bchanot committed 2026-10-28 20:34:35 +01:00
1 parent 7c4bf124f4
commit 538d10369f
4 files changed
+39 -4

No files matched your search

+3 -2
View File
@@ -93,8 +93,9 @@ end $$;
grant execute on all functions in schema pg_temp to authenticated;
grant select on pg_temp.who to authenticated;
-- 6 callers x 2 levels x 2 operations x 4 roles x 2 targets = 192 cases: 16
-- allowed (one assertion), 176 refused (two assertions).
-- 6 callers x 2 levels x 2 operations x 4 roles x 2 targets = 192 cases: 12
-- allowed (one assertion: owner 4 roles, admin 2, each for grant and revoke),
-- 180 refused (two assertions).
select pg_temp.role_case(c, l, o, r, s)
from unnest(array['N', 'O', 'A', 'M', 'S', 'D']) with ordinality c(c, ci),
unnest(array['aal1', 'aal2']) with ordinality l(l, li),