© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•14mo ago•
10 replies
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'
)
)
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'
)
)
using (
  select user_id from public.access_control
  where user_id = (select auth.uid()) and role = 'admin'
)
)
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

RLS policies
SupabaseSSupabase / help-and-questions
13mo ago
Question about RLS policy
SupabaseSSupabase / help-and-questions
4y ago
Multiple RLS Policies
SupabaseSSupabase / help-and-questions
4y ago
Testing RLS policies
SupabaseSSupabase / help-and-questions
4y ago