SupabaseS
Supabase12mo ago
Strange

Quick question about RLS join policies

Hello! I remember seeing a post somewhere about increasing the performance of RLS by improving the performance of the queries, and it went something like this with joins:

Bad:
using (
(select auth.uid()) in (
  select user_id from public.access_control
  where role = 'admin'
)
)


Good:
using (
  select user_id from public.access_control
  where user_id = (select auth.uid()) and role = 'admin'
)
)
Was this page helpful?