Supabase Performance Cost

N+1 Supabase queries: .from() called inside a loop

Part of the Performance advisors check · fix arrives as a pull request

What it is

A .from() query is issued inside a loop, producing one round trip per iteration instead of one for the whole set.

Why it matters

Each iteration pays full network latency, so a list of 200 becomes 200 sequential requests. It looks fine against seed data and times out against real data.

How to fix it

Collect the ids first and fetch them in one call with .in('id', ids), or express the relationship as a nested select() so Supabase returns the joined rows in a single response.

Run them all on your app

Connect your repo and your live services with read-only scopes. The first scan is free, and nothing changes without your approval.