← All guides

Supabase Only Returning 1,000 Rows? Why Lists Stop and Totals Go Wrong

SupabaseLovableBolt

The orders page lists exactly 1,000 orders, and that number hasn’t moved in a week although customers keep buying. The CSV your accountant asked for ends at row 1,000. The revenue card on the admin dashboard is lower than the figure in Stripe. Nothing turns red in the console, and when you describe it to the AI builder, it restyles the chart.

This isn’t a display bug. Every supabase.from(...) call in your app goes through Supabase’s Data API, and that API sends back no more than a fixed number of rows per request. On Supabase projects the number starts at 1,000. Rows past it are left out without an error. This guide shows how to prove that’s what is happening, lists the other causes that produce a similar picture, and gives three fixes in the order you’d reach for them. It covers Supabase projects you connected yourself as well as Lovable and Bolt apps that read from Supabase, and the per-platform pages for Lovable, Bolt and Supabase link related guides, plus a way to hand the fix to an engineer. Speed problems with large tables are a separate subject and aren’t covered here.

Why the list stops at 1,000

The Data API is PostgREST, a server that turns HTTP requests into SQL (Supabase: Data REST API). PostgREST has a setting called db-max-rows, which its configuration reference defines as a hard ceiling on how many rows it reads for any one request, there to stop a stray or abusive request from returning an enormous payload. Tables, views and functions all fall under it.

The two projects document different defaults for that ceiling:

  • PostgREST lists the default as unlimited (∞). A bare PostgREST server caps nothing until you set it.
  • Supabase sets it to 1,000. Its select() reference notes (Flutter: select, and the same text in the doc comment of supabase-js’s select()) say projects return at most 1,000 rows unless you change the setting, and the CLI configuration reference gives api.max_rows a default of 1000 for local projects.

So the 1,000 comes from Supabase’s configuration, not from PostgREST or from your code. Three details explain why it goes unnoticed:

  1. It’s a ceiling, not a default page size. Asking for more with .limit(10000) or .range(0, 9999) doesn’t lift it; the server still stops at the cap.
  2. It isn’t an error. PostgREST’s pagination page shows that a response can contain fewer rows than requested and still come back as 200 OK. supabase-js hands you data with 1,000 items and error: null.
  3. It covers functions and views too. Supabase’s description of max_rows names views and functions alongside tables, so when .rpc() calls a function that returns a long list of rows, that list gets trimmed at the cap as well.

Here’s how it appears in an AI-built app. A page loads with select('*'), the code counts the result with data.length or adds up a column in JavaScript, and every number is right while the table is small. Once the table grows past 1,000 rows, the list freezes, the count stops at 1,000 and the sum stops growing. Nothing in the code changed, which is why asking the AI to “fix the chart” goes nowhere.

Confirm it in two minutes

You need two numbers: how many rows the table really has, and how many your app received.

  1. Count in the database. In the Supabase dashboard, run select count(*) from public.orders; in the SQL Editor (use your table name). In Lovable Cloud, the Database view shows an approximate row count beside each table, and More → Database → Manage → SQL editor runs the same query (Lovable: Database). In Bolt, open the database settings with the database icon; the Tables page lists each table with its row count, and a table’s Query button runs SQL (Bolt: Tables).
  2. Look at the request. Open the page in Chrome, open DevTools, pick the Network tab, then refresh the page. (Our Failed to fetch guide walks through the panel step by step.) Click the row for /rest/v1/orders and read its response headers. PostgREST puts a Content-Range header on every response; 0-999/* means rows 0 to 999 came back, which is 1,000 rows.
  3. Compare. If the app received exactly 1,000 rows and the table holds more, the cap is the cause. If someone raised the cap, look for that new number instead.

If the app’s number is lower than the table’s and isn’t a round figure, keep reading: one of the causes below is more likely.

Other causes that look similar

Check each before changing anything; more than one can apply.

What you seeCause to checkHow to tell
Exactly 1,000 (or your configured cap)Max rows on the Data APIContent-Range ends at 999; the database count is higher
A round number that appears in your code, like 100 or 500A .limit() in the querySearch the code for .limit(. supabase-js adds no limit of its own: select() sends no limit parameter unless the code calls .limit() or .range() (postgrest-js source)
Pages repeat a row, or one row goes missing between pagesrange() off by onerange(from, to) counts from 0 and includes both ends (range reference). range(0, 10) returns 11 rows, and pages built as range(page * 10, (page + 1) * 10) overlap by one
Rows shuffle or appear twice across pagesrange() with no .order()Supabase’s reference warns that a range without an order clause can behave unexpectedly
Fewer rows for one user than another, not a round numberRow Level SecurityPolicies hide rows the signed-in user isn’t allowed to read
You raised the cap, and the app still shows 1,000A cached responseSee the FAQ at the end

Row Level Security deserves a closer look because it’s working as designed. Supabase’s RLS guide suggests thinking of each policy as a WHERE clause added to every query, so a customer sees their own orders and nothing else. That also applies to counts and sums. If an admin dashboard shows only the admin’s own orders, the table needs a policy that lets admins read everyone’s rows; our admin roles guide builds one, and RLS policies explained covers how policies filter reads.

Should you raise Max rows instead?

Supabase’s own advice, in the same notes, is to keep it low, so that a stray or abusive request can’t bring back an enormous response, and to page through data with range() instead.

Raising it doesn’t remove the problem, it postpones it: the code still downloads whole tables, and it breaks again when the table outgrows the new number. Meanwhile every request that forgets a filter gets heavier, and the bigger allowance applies to anyone holding your publishable key, not only to your own pages. A higher cap is reasonable for a table you know stays bounded, such as a list of countries. For orders, events, messages or log rows, fix the queries.

Where the setting lives (the docs point to two places)

Supabase’s pages don’t agree on where this lives in the dashboard:

None of the pages we opened shows the Max rows field itself. Try your project’s API settings page first; if there’s no Max rows field there, open Integrations > Data API > Settings. For a local project, the same cap is the max_rows key in the [api] block of your CLI config file; the CLI reference lists its default as 1000.

On the AI builders:

  • Lovable Cloud. Lovable says its built-in backend is based on Supabase’s open-source stack (Lovable: Cloud), but its docs don’t mention a row cap, and the database Settings they describe cover instance size, location, export and pausing, with no row limit (Lovable: Database). Plan on fixing this in code, and use the checks above to see what your project actually returns.
  • Bolt. Bolt’s database docs don’t describe a row-limit setting for Bolt Database. If you claimed your database into Supabase or connected your own Supabase project (Bolt: Supabase integration), the Supabase dashboard is where you’d look.

Fix 1: paginate lists with order() and range()

A list that a person scrolls through never needs 50,000 rows at once. Fetch one page at a time, with an order that can’t tie:

const PAGE_SIZE = 50;

export async function fetchOrdersPage(page: number) {
  const from = page * PAGE_SIZE;
  const to = from + PAGE_SIZE - 1; // range() includes both ends

  const { data, error, count } = await supabase
    .from('orders')
    .select('id, created_at, customer_name, total', { count: 'exact' })
    .order('created_at', { ascending: false })
    .order('id', { ascending: false }) // tiebreaker: no two rows share an id
    .range(from, to);

  if (error) throw error;
  return { rows: data, total: count ?? 0 };
}

What each part does:

  • .range(from, to) asks for rows from through to, both included and counted from 0. Under the hood, supabase-js turns it into offset and limit parameters on the request, with the limit set to to - from + 1 (postgrest-js source). Keep PAGE_SIZE at or below your Max rows, or every page gets cut short.
  • Two .order() calls. The order reference allows calling it more than once to sort by more than one column. Sorting by created_at alone lets two orders placed in the same instant swap places between requests; adding the unique id fixes the sequence.
  • count: 'exact' reports how many rows pass your filters in total, whatever page you’re on, as the select() documentation in supabase-js’s source explains. That’s what page numbers and “Showing 51–100 of 3,214” need. On large tables, consider the cheaper count options in the next section.

Infinite scroll uses the same pattern: keep a page counter, fetch the next range when the user nears the bottom, and stop once a page returns fewer than PAGE_SIZE rows.

Fix 2: count rows without downloading them

If a card on the dashboard is stuck at “Total customers: 1,000”, check whether the app downloads the rows and counts them in the browser. If it does, ask Postgres for the number instead:

const { count, error } = await supabase
  .from('customers')
  .select('*', { count: 'exact', head: true });

// with filters, the count follows them:
const { count: paidThisMonth } = await supabase
  .from('orders')
  .select('*', { count: 'exact', head: true })
  .eq('status', 'paid')
  .gte('created_at', '2026-12-01');

head: true sends the request without asking for rows, so data is null and only count is filled in. This is the “Querying with count option” example in the select() reference, and a count isn’t limited by Max rows.

There are three counting methods, and supabase-js and PostgREST word them differently:

Optionsupabase-js descriptionPostgREST’s description
'exact'Runs COUNT(*); precise, slowerPrecise; gets slower as the table grows
'planned'Approximate, from Postgres statistics; fastAs accurate as the table’s statistics; running ANALYZE on the table refreshes them
'estimated'Exact for small numbers, planned for large onesExact up to a threshold, and that threshold is db-max-rows

The two sources don’t contradict each other, but only PostgREST’s pagination and count page names the threshold. On a Supabase project that means 'estimated' is exact up to your Max rows and approximate above it, and raising Max rows moves that line. The supabase-js wording is in the select() parameter docs in its source. A rule that works whichever wording you follow: use 'exact' for numbers that carry money or obligations (orders, invoices, seats), and 'planned' or 'estimated' for “about 2.4 million events” style figures.

Counts follow Row Level Security like any other query. A count run by a regular user covers only the rows that user can read.

Fix 3: compute totals and charts in Postgres

Revenue per day, signups per week and top products are all the same mistake when they’re computed in the browser: download every row, then loop. Past the cap, the loop runs over the first 1,000 rows and nothing tells you. Move the arithmetic into the database, where the cap doesn’t matter because only the answer travels.

A database function called through .rpc() works well for this (Supabase: Database functions):

create or replace function public.order_totals_by_day(from_date date, to_date date)
returns table (day date, orders bigint, revenue numeric)
language sql
stable
security invoker
set search_path = ''
as $$
  select o.created_at::date as day,
         count(*)           as orders,
         sum(o.total)::numeric as revenue
  from public.orders o
  where o.created_at >= from_date
    and o.created_at <  to_date + 1
  group by 1
  order by 1;
$$;

revoke execute on function public.order_totals_by_day(date, date) from public, anon;
grant execute on function public.order_totals_by_day(date, date) to authenticated;
const { data, error } = await supabase.rpc('order_totals_by_day', {
  from_date: '2026-11-01',
  to_date: '2026-11-30',
});

Before you run it, check these points:

  • security invoker runs the function with the caller’s rights, so the table’s RLS policies still decide which orders count. Supabase’s functions guide recommends invoker (the default) and warns that a security definer function owned by postgres skips RLS and can be called by anyone by default. For an admin-only report, give admins a read policy as in the admin roles guide rather than switching to definer.
  • The revoke and grant lines. Supabase’s functions guide explains that any role can run a new function by default, through a grant to PUBLIC. The two lines limit this report to signed-in users. If you ever drop the function and create it again, which Postgres requires when you change its return columns (PostgreSQL: CREATE FUNCTION), those permissions go with it, so run the revoke and grant lines again. A plain create or replace keeps them.
  • Days are cut at midnight in the database session’s time zone. If your business day ends at a different hour, adjust the cast.
  • It returns one row per day. That’s well under any cap for a date range of a few months, but a function’s row output still counts against Max rows, so don’t ask it for a 10-year daily series.

If you’d rather query a view with .from(), a view works too, with two conditions. Supabase’s RLS guide warns that views skip RLS by default because they’re created by postgres, so create it with security_invoker turned on (Supabase: Views):

create view public.monthly_revenue
with (security_invoker = true) as
  select date_trunc('month', created_at) as month,
         count(*)    as orders,
         sum(total)  as revenue
  from public.orders
  group by 1;

revoke all on public.monthly_revenue from anon;
grant select on public.monthly_revenue to authenticated;

The grant matters because, depending on your project’s Data API settings, a new object in public may not be reachable until you grant access (Securing your API); without it, the view fails with the error our 42501 guide explains. Supabase’s views guide adds that a security_invoker view needs select on the underlying table as well, which your app’s role already has if it can read orders. If the view is ever dropped and recreated, run both lines again and make sure the new statement still includes with (security_invoker = true).

Exporting every row to CSV

An export is the one case where you do want everything. There are two routes.

One-off exports, from the dashboard. Lovable’s Database view has an Export CSV button that, per its docs, writes every row matching the current filters rather than the visible page (Lovable: Database). Bolt’s Tables page exports rows you select as CSV or JSON (Bolt: Tables). In Supabase, you can run a query in the SQL Editor and export the results as CSV; the user management guide mentions this for the auth.users table. The editor itself also trims results: a 2024 dashboard change added an automatic row limit to any query that has no limit of its own, with an “auto limit” note under the results and a dropdown to change it (Supabase pull request #26857). Look for that note, or write your own limit clause, before trusting the file. Whichever route you use, compare the file’s line count with your count(*).

Exports from inside the app. Loop through pages on the server and stop at the first short page:

import type { SupabaseClient } from '@supabase/supabase-js';

type Order = { id: number; created_at: string; customer_email: string; total: number; status: string };

export async function fetchAllOrders(supabase: SupabaseClient, pageSize = 1000) {
  const rows: Order[] = [];

  for (let from = 0; ; from += pageSize) {
    const { data, error } = await supabase
      .from('orders')
      .select('id, created_at, customer_email, total, status')
      .order('id', { ascending: true })
      .range(from, from + pageSize - 1);

    if (error) throw error;
    rows.push(...(data as Order[]));
    if (data.length < pageSize) break; // last page
  }

  return rows;
}

Three rules keep this loop honest:

  • pageSize can’t exceed Max rows. If it does, the first page comes back holding only as many rows as the cap allows, the loop reads that as the last page, and you’re back to a 1,000-row export.
  • Order by a unique column. Without it, rows can be read twice or skipped between pages.
  • Rows written or deleted during the export can shift the pages. If id is an increasing number, new rows land at the end; UUIDs can sort anywhere. For a consistent file, also filter on created_at up to the moment the export began.

Where the loop runs depends on the app:

  • Edge Functions for projects you manage yourself and for older Lovable apps. In Bolt, use its server functions, which Bolt also calls edge functions (Bolt: Server functions).
  • Server functions or API routes for newer Lovable apps, started May 13, 2026 or later. Those apps are built on TanStack Start, keep their server code in the app itself, and might not contain a single Edge Function (Lovable: Edge functions).

Lovable’s page also points out that anyone who knows a function’s address can call it, so the export must check who is asking. Prefer running the queries with the requesting user’s session, so RLS decides what they can export. If you use a secret key to read everything, note that it skips RLS only on requests that don’t also include a signed-in user’s access token (Supabase RLS guide), and the function must confirm the caller is an admin first.

Large exports also run into time limits. Supabase publishes wall-clock, CPU and idle-timeout limits for Edge Functions, and a function that doesn’t respond in time returns 504 Gateway Timeout (Edge Functions limits). Lovable limits its two kinds of server code independently, and for Edge Function figures its docs send you to support. If the export dies partway, read its logs; the non-2xx guide shows where they are in Lovable Cloud and Bolt.

Have the AI builder audit every query

The cap applies to every read, so fixing the one page you noticed leaves the others waiting to break. Give your AI tool a bounded audit task:

Find every Supabase query in this app that reads from a table, view or function that could hold more than 1,000 rows. For each one, list the file, the table, and what the result is used for (a list, a count, a sum or chart, an export). Don’t change anything yet. Then propose: .order() plus .range() for lists; select('*', { count: 'exact', head: true }) for counts; a Postgres function with security invoker called via rpc() for sums and charts; and a server-side loop with pages no larger than 1,000 for exports. Don’t raise any limits and don’t change RLS policies.

Review the list before approving edits; a query on a table that can’t grow can stay as it is.

FAQ

Why does my Supabase query return exactly 1,000 rows?

Because Supabase sets the Data API’s Max rows cap to 1,000 by default, and the API stops there without raising an error. To confirm, compare count(*) in the SQL editor with data.length, or read the Content-Range header on the request.

Does .limit(10000) override the cap?

No. PostgREST treats db-max-rows as a hard limit, so .limit() and .range() can ask for fewer rows than the cap but never more. Paginate, count with head: true, or compute the total in Postgres.

Is it the same on Lovable Cloud?

Lovable’s docs describe the built-in backend as based on Supabase, but they don’t mention a row cap or any setting for one. Don’t rely on either answer: log data.length and check the Content-Range header on your app’s requests, then fix the queries the same way.

Will paginating make my app slower?

Each request gets smaller, since a page of 50 rows is a lighter response than a full table. The cost to watch is count: 'exact', which PostgREST says slows down as a table grows; switch to 'planned' or 'estimated' where an approximate total is fine. Slow queries on big tables have other causes, such as missing indexes, which are outside this guide.

I raised Max rows, so why do I still get 1,000?

First make sure the request actually reached Supabase. In a GitHub issue about Next.js server components, the 1,000-row result persisted after the setting was raised; a Supabase collaborator replied that this was likely Next.js caching the earlier response, and closed the issue “for now” on that basis. Change the query slightly or check the Network tab for a fresh request. Then check the code for a .limit() or a range() that ends at 999.

Comments

Add a comment

Generated for you. Click to type your own.

Required. Never shown on the page. Privacy policy.

Basic markdown: **bold**, *italic*, `code`, lists, quotes, and fenced code blocks. HTML shows as plain text.

Your draft stays on this device until you post.