ended5월 21일· 1 sources
The Query Planner Trap: How Supabase RLS Policies Multiply Auth Function Calls
Supabase RLS, 쿼리 플래너 함정과 간단한 해결책
Why it matters
Supabase users often unknowingly write RLS policies that re-evaluate auth functions for every row scanned—a performance pitfall invisible on small datasets but devastating at scale. The fix is surprisingly simple: wrapping auth.uid() in a subquery lets the query planner extract it into an init plan that runs once per query, not per row. This article reveals the root cause and shows how automated tooling can catch optimization issues that slip through manual review.
1
Sources
+0
24h
—
Growth
123d
Active
SupabaseRLS policiesQuery optimizationPostgreSQLinit-plan