Skip to content
Discussion options

You must be logged in to vote

Honestly, the biggest headache with serverless and Supabase is the connection limit. If you're using Vercel or Lambda, you have to use the connection pooler (port 6543) in transaction mode. If you go direct, you'll hit FATAL: too many connections the second you get a traffic spike.

For the RLS part, don't do joins in your USING clause. It’s a silent killer for performance. The best move is to bake your user roles/org IDs into the JWT claims using a trigger. That way, the RLS check is just reading a string from the token instead of hitting the disk. If it’s still too slow, just wrap the logic in a security definer RPC and skip the RLS entirely for that specific query.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by GitAlboBis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General General topics and discussions that don't fit into other categories, but are related to GitHub Question Ask and answer questions about GitHub features and usage Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community!
3 participants