Supabase and PostgresPlatform operationsreference
Supabase log volume per request
Logs Ingest on Supabase is billed per byte across every service, at $0.50 per GB (gigabyte) after 20 GB included on paid plans.1 This page measures where those bytes come from: how much each kind of client request writes to the project logs, and how much the Postgres logging settings a project owner can change add on top. It is for whoever has to explain a logs line on an invoice, or decide which change on their side moves it.
The LV01 and LV02 rows ran on 2026-10-15 from one macOS machine in Singapore (Bun 1.3.14) against throwaway projects in ap-southeast-1 on a Pro-plan organisation, one project per module run, created and read back through the Management API (application programming interface) from the same machine; the client actions went straight to the project API. LV01 ran twice (run1, run2) with 100 actions per row; LV02 ran three times (run1 to run3) with 50 requests or statements per condition. The figures are quoted from the RUNLOG of the logs-volume experiment, and redacted copies of the run artifacts are linked in Modules. Rows marked documented come from the public pages cited at the claim and were not run. LV03 (2026-11-09) and LV04 and LV05 (2026-11-10) ran once each from the same machine on a Team-plan organisation (Postgres 17.11, PostgREST 14.18), each on a project created with no desired_instance_size (compute size not read back); their figures are in the RUNLOG at the later commit. LV06 (2026-11-10) ran once from the same machine on a Team-plan organisation with Supabase CLI (command-line interface) 3.1.0, on a project created with no desired_instance_size, and did not record its Postgres or PostgREST version; its figures are in the RUNLOG at commit e588e6d. LV07 (2026-11-19) ran once from the same machine (Bun 1.3.14) on a Pro-plan organisation with lru-cache 11.5.3 and node-postgres (version not recorded), on a project created with no desired_instance_size (region requested ap-southeast-1, not read back); its figures are in the RUNLOG at commit 8df3070.
Size is a proxy throughout. Metered ingest bytes are not readable with a personal access token (the organisation usage route answered 401, observability surface), so “bytes” here is the length of a row’s event_message plus every key and value in its log_attributes map, as the logs endpoint returns it. The figures compare actions with each other; they do not predict the GB on an invoice.
TL;DR:
- A REST (representational state transfer) read or single-row write produced about 0.9
edge_logsrows per request in LV01 (600 of 600 reads in LV07a); a REST GET row is 1807 bytes. A 100-row bulk insert produced one row. - An Edge Function call with no console output wrote about 3,019 bytes in 2.81 rows: a
function_edge_logsrow plus a Boot and a Shutdown row infunction_logs. Each ~100-characterconsole.logline added about 520-540 bytes. auth.getUser()wrote 2,604 bytes per call;auth.getClaims()with an ES256 token wrote 27 bytes per call (2 rows for 100 calls).- Public Storage reads served from the CDN (content delivery network) cache are logged: 100 reads with 99
cf-cache-status: HITproduced 99 (run1) and 90 (run2)edge_logsrows. - A read cache in the backend wrote nothing for the reads it answered: one 600-read trace wrote 600
edge_logsrows uncached, and through lru-cache with a 5 s and a 30 s lifetime made 154 and 40 REST calls that wrote 154 and 40 rows (LV07). - 100 Realtime broadcast messages over an open WebSocket wrote no
realtime_logsoredge_logsrows (both runs;run20 rows and 2 bytes per message after idle subtraction). - On a new project (
log_statement=ddl,log_min_duration_statement=-1) REST GETs and SQL (Structured Query Language)selectstatements wrote 0postgres_logsrows. Ofpostgres,authenticatorandanon, only settings onauthenticatorlogged REST requests:log_statement=alladded 4,405 bytes per REST request andlog_min_duration_statement=0added 9,026 bytes. - A role setting on
postgresreached new direct sessions at once and had not reached new sessions through the shared pooler 75-453 s later.alter role authenticator reset allreturned OK and cleared nothing.
Which change moves which source
Section titled “Which change moves which source”| Source in the logs | What writes it | Lever on the project side | Measured here |
|---|---|---|---|
edge_logs | every HTTP request to the project API, cache hits included | send fewer requests: client or app caching, Realtime in place of polling, bulk writes, fewer round trips | LV01b-d, LV01h-j, LV07a-c |
auth_logs | Auth server calls such as getUser and auth.admin.getUserById | verify the JWT (JSON Web Token) locally with getClaims; cache admin user lookups per user id | LV01h, LV01i, LV07f, LV07g |
supavisor_logs | client connections to the shared pooler | keep connections open in a pool | LV07h, LV07i |
function_edge_logs, function_logs | every Edge Function invocation, plus the function’s own console output | fewer invocations; remove debug console.log | LV01e-g |
postgres_logs | Postgres itself, per the logging settings in force | reset log_statement, log_min_duration_statement, pgaudit.log where raised; avoid RAISE LOG in hot functions | LV02 |
pgbouncer_logs, background postgres_logs | the platform, with no client traffic | none | LV01a |
realtime_logs | not seen per message in either LV01 run | - | LV01k, LV01l |
Text version of the diagram:
- A REST, Auth or Storage request to the project API wrote up to one
edge_logsrow at the gateway (0.83-0.97 per request; 1807 bytes for a REST GET), including Storage reads served from the CDN cache; an Edge Function call wrote afunction_edge_logsrow instead. - Behind the gateway, PostgREST logs in as
authenticatorand switches toanonorauthenticated; at defaults Postgres wrote nopostgres_logsrow for a REST GET (LV02a), and one row per call for a function that runsRAISE LOG(LV02i). - An Auth call writes an
auth_logsrow (608 bytes forgetUser) as well as its gateway row. - An Edge Function call writes a
function_edge_logsrow and a Boot and a Shutdown row infunction_logs, plus one row per console line. - A Realtime broadcast message on an already open WebSocket wrote no
realtime_logsoredge_logsrow.
Per client action
Section titled “Per client action”Measured, LV01 run2, 100 actions per row (LV01d n = 1), sequential, one project. run1 values in brackets where it measured the same thing. Keys: the legacy anon key for REST GETs, Edge Functions and Realtime; the legacy service_role key for REST inserts and Storage setup; no key for the public Storage reads; a password-signed-in user with an ES256 access token for the Auth rows. Per-action figures for the non-function rows subtract the idle rate from LV01a.
| Row | Action | Rows per action | Bytes per action | Where the bytes are |
|---|---|---|---|---|
| LV01b | REST GET, anon key | 0.91 (0.85) | 1659 (1520) | edge_logs, 1807 bytes per row |
| LV01c | REST insert, service_role key, one row per request | 0.92 (0.88) | 1610 (1525) | edge_logs |
| LV01d | REST insert, service_role key, 100 rows in one request (n = 1) | 1 edge_logs row (1) | 1771 (1771), edge_logs only | one row in both runs; all sources 2047 (1554), the difference is pgbouncer_logs idle-subtraction noise |
| LV01h | auth.getUser(), signed-in user | 1.98 (1.89) | 2604 (2343) | edge_logs plus one auth_logs row of 608 bytes |
| LV01i | auth.getClaims(), same user, ES256 token | 0.03 (0.03) | 27 (27) | 1 auth_logs and 1 edge_logs row for the 100 calls |
| LV01j | Storage public object, no key, same object | 0.97 (1.12) | 1014 (1144) | edge_logs; responses 1 MISS, 99 HIT in both runs; run1 1.12 includes 0.06 late function_logs and 0.06 pgbouncer_logs rows |
| LV01k | Realtime broadcast over an open WebSocket | 0 | 2 | 100 of 100 messages received |
| LV01e | Edge Function, anon key, no console output | 2.81 | 3019 | function_edge_logs 0.91 rows; function_logs Boot:95 Shutdown:95 |
| LV01f | Edge Function, one ~100-character console.log | 3.88 | 3622 | Boot:97 Log:100 Shutdown:97 |
| LV01g | Edge Function, ten console.log lines | 12.77 | 8221 | Boot:93 Log:1000 Shutdown:93 |
The Rows per action and Bytes per action columns are all-sources totals - the idle-subtracted sum across log sources - for every row except LV01d, whose figure is edge_logs only and gives its all-sources total beside it. The Where the bytes are column names the source the figure is read from, and the prose below quotes the edge_logs-only counts where they differ.
100 rows written one per request produced 91 edge_logs rows (LV01c, run2); 100 rows written in one request produced 1 (LV01d).
Edge Functions
Section titled “Edge Functions”A silent invocation still wrote rows, even when the function printed nothing: a gateway row in function_edge_logs and two lifecycle rows in function_logs, Boot and Shutdown. The 100 sequential calls in LV01e (run2) produced 95 Boot and 95 Shutdown rows, which suggests nearly every call started its own worker (inferred from the event types). Each ~100-character console line then added about 520-540 bytes: LV01f minus LV01e is 1,482 - 940 bytes of function_logs per invocation, and LV01g gives (6,150 - 940) / 10.
Shutdown rows arrived up to about 3.5 minutes after the request (an exploratory probe of 20 invocations with 20 Boot and 20 Shutdown rows, not archived). Counting function_logs by time window therefore undercounts: run1 did that and attributed 0.98 function_logs rows per invocation, and the late rows (event type not recorded in run1) showed up in later windows. run2 counts by log_attributes['function_id'] from the start of each phase, and that is the figure above.
Auth: getUser against getClaims
Section titled “Auth: getUser against getClaims”getUser() calls the Auth server, and each call wrote an edge_logs row and an auth_logs row, 2,604 bytes in run2. getClaims() verifies the token locally against a cached JWKS (JSON Web Key Set) when the project signs with asymmetric keys, and calls the Auth server when it signs with the legacy symmetric secret.2 New projects issued ES256 user tokens here, and 100 getClaims() calls wrote 1 auth_logs and 1 edge_logs row in total. The request path of those two rows was not recorded; a JWKS fetch is what the docs describe. A server that calls getUser() on every request adds about 2,604 bytes to each request (derived from LV01h).
Caching and Storage
Section titled “Caching and Storage”Public Storage reads served from the CDN cache are logged. The same 1 KB object, fetched 100 times with no query string, came back 1 MISS and 99 HIT (cf-cache-status) in both runs and produced 99 (run1) and 90 (run2) edge_logs rows, about 1 KB each: a CDN cache HIT still wrote an edge_logs row. A cache in the client, the application or the project owner’s own CDN keeps the request from reaching the project at all; LV07 measured that for a cache in the backend (next section), and a client cache and the owner’s own CDN were not measured.
A read cache in the backend
Section titled “A read cache in the backend”LV07 played a project owner’s backend: REST reads with fetch() and the legacy service_role key, supabase-js for auth.admin.getUserById, lru-cache 11.5.3 and node-postgres, against a table of 20 businesses with 3 rows each, where a read is select id,status for one business. One trace of 600 reads (Poisson arrivals with a 100 ms mean gap, Zipf(1) popularity over the 20 keys, generated from a fixed seed) was replayed three times in one run: with no cache, and through lru-cache fetch() with a 5 s and a 30 s lifetime. Each phase marked its requests in the query string, and its edge_logs rows were counted by marker.
| Row | Read path | REST calls | edge_logs rows | Hit rate |
|---|---|---|---|---|
| LV07a | no cache | 600 | 600 | - |
| LV07b | lru-cache, 5 s lifetime | 154 | 154 | 0.743 |
| LV07c | lru-cache, 30 s lifetime | 40 | 40 | 0.933 |
Hit rate is 1 - REST calls / 600; a read that arrived while its key’s fetch was in flight counts as a hit, as it would in a backend. Every row came from a REST call the cache made; the reads it answered wrote none. All 600 uncached reads had an edge_logs row, counted before the 120 s read-back tail, against 84-92 of 100 in LV01b after a 300 s tail.
The same trace also tested an estimate that needs only the logs: split time into buckets of the cache lifetime and count a request as a hit when its key already appeared in the bucket (1 - distinct(key, bucket) / requests).
| Lifetime | Estimate from the logged rows | Estimate from client send times | Replay through a fill-time cache, no network | lru-cache in LV07b-c |
|---|---|---|---|---|
| 5 s | 0.682 | 0.68 | 0.742 | 0.743 |
| 30 s | 0.92 | 0.92 | 0.933 | 0.933 |
The bucket estimate came out below the cache that ran, by 0.061 at 5 s and 0.013 at 30 s on this trace, because a bucket boundary drops an entry that a real cache keeps until its lifetime ends. A replay of the trace through a cache that keeps each entry for the lifetime after it was filled matched the live cache to 0.001. The gap depends on arrival rate and key spread, which one trace does not cover. The cache estimate guide applies the same bucket method, keyed per path and query string, to a project’s own edge_logs.
Four other rows from the same run:
| Row | What ran | Result |
|---|---|---|
| LV07d | 50 concurrent fetch() for one key on an empty cache | 1 REST call, 1 edge_logs row, 50 of 50 callers got the 3 rows |
| LV07e | cached read (60 s lifetime), PATCH of one row to away (HTTP 204), read again | without cache.delete() the read returned online; after delete() it returned away |
| LV07f | auth.admin.getUserById, 50 sequential calls with the service_role key, no cache | per call 1 edge_logs row (2015 bytes) and 1 auth_logs row (789 bytes), 2804 bytes per call across both sources |
| LV07g | the same 50 lookups through lru-cache (300 s lifetime) | 1 call made; 1 edge_logs and 1 auth_logs row in the window |
Reads that skip the API and go to Postgres write no gateway row, and what they write depends on the connection pattern. On the shared pooler in transaction mode (port 6543) as postgres; log_connections was not read in this run, and no postgres_logs rows above the idle rate appeared in either window:
| Row | Connection pattern | Rows per read or connection |
|---|---|---|
| LV07h | 200 reads over one pg.Pool (max 2), connections opened before the window | 3 supavisor_logs rows for the 200 reads (0.02 per read, 11 bytes per read); no postgres_logs above the idle rate |
| LV07i | 30 reads, each on a new connection (connect, query, end) | 4.1 supavisor_logs rows and 2924 bytes per connection; no postgres_logs above the idle rate |
A connection per read (2924 bytes) wrote more than a REST GET did in LV01b (1659 bytes per request, anon key, 2026-10-15); LV07 did not record bytes per REST read. Not measured: several backend instances each with its own cache, reads under row-level security (the cache key then has to include the user), log_connections on, session mode, the dedicated pooler and direct connections.
Realtime against polling
Section titled “Realtime against polling”100 broadcast messages over an open WebSocket, all received, wrote no realtime_logs or edge_logs rows (LV01k, both runs), and two subscribed clients idling for 180 s wrote nothing attributable to them (LV01l: every source at or below the idle rate in run2; run1 had 1 edge_logs row and 70 late function_logs rows in the 186 s window). The same updates fetched by polling cost a gateway row per poll: one client polling every 5 seconds sends 17,280 requests a day, which at LV01b’s 1,659 bytes is about 28.7 MB (10^6 bytes) a day, or 0.86 GB over 30 days, per open client (derived from LV01b, not measured as a polling run). Realtime Postgres Changes were not measured.
Idle background
Section titled “Idle background”With no client traffic, a project wrote at a rate of 520 pgbouncer_logs, 40 postgres_logs and 60 function_logs rows an hour (both runs), extrapolated from one 180 s window, about 4.2 MiB a day (run1 4.4). The 3 function_logs rows in that window are probably Shutdown rows from the setup’s warm-up invocations (not determined). No setting for the pgbouncer_logs and postgres_logs background was found (not tested).
Row completeness
Section titled “Row completeness”Not every request produced a row the run could find. For 100 marked REST GETs, edge_logs held 84 (run1) and 92 (run2) rows, unchanged after a 300 s tail in run2; function_edge_logs counts per 100 invocations were 86-94 across both runs, and Boot counts were 93-97 (run2). Whether that is sampling, loss, or arrival later than the run waited is not determined. Read every per-request row count on this page as covering about 83-97 of every 100 requests (lowest: LV01h run1, 83 edge_logs rows).
Postgres logging settings
Section titled “Postgres logging settings”The postgres role can change log_statement, log_min_duration_statement and pgaudit.* at role level through supautils; log_connections and log_disconnections are listed as CLI-only project settings.3 The logs-ingest page lists log_statement, log_min_duration_statement, log_connections, pgAudit, and RAISE NOTICE / RAISE LOG in functions as the volume sources a project owner controls.1 On a new project the defaults were log_statement=ddl, log_min_duration_statement=-1, log_min_messages=warning and log_connections=off, and the platform roles supabase_auth_admin, supabase_storage_admin and supabase_admin carry log_statement=none at role level (read on a dev project, not archived).
Measured, LV02 run3, 50 anon REST requests and 50 SQL statements per path per condition. Settings were applied with alter role ... set from a postgres session through the shared pooler (session mode, 5432); REST traffic waited 45 s after each change, longer than PostgREST’s default 30 s db-pool-max-idletime,4 so PostgREST should open a new pool connection (not measured; the platform’s own value was not read). LV05b (2026-11-10) later found idle pool connections kept past 330 s, so how these settings reached REST requests after 45 s is open; see When an authenticator setting takes effect. run1 and run2 gave the same REST rows per request except run1 LV02e (0.02); bytes were within 16 bytes per request of run3. The direct path was measured in run3 only.
| Row | Setting | postgres_logs per REST request | Per SQL statement, direct connection | Per SQL statement, shared pooler (session mode, 5432) |
|---|---|---|---|---|
| LV02a | defaults | 0 | 0 | 0 |
| LV02b | postgres log_statement=all | 0 | 1.02 rows, 621 bytes | 0 (session reported log_statement=ddl) |
| LV02c | authenticator log_statement=all | 4.02 rows, 4405 bytes | 0 | 0 |
| LV02d | anon log_statement=all | 0 | 0 | 0 |
| LV02e | postgres log_min_duration_statement=0 | 0 | 1.02 rows, 661 bytes | 0 (session reported log_min_duration_statement=-1) |
| LV02f | authenticator log_min_duration_statement=0 | 8.1 rows, 9026 bytes | 0 | 0 |
| LV02g | postgres pgaudit.log=all | 0 | 1.02 rows, 681 bytes | 0 (session reported pgaudit.log=none) |
| LV02h | defaults, RPC with RAISE NOTICE | 0 | - | - |
| LV02i | defaults, RPC with RAISE LOG | 1 row, 1336 bytes | - | - |
The role that matters for REST requests is authenticator, the role PostgREST logs in as. The same log_statement=all on anon, the role it switches to per request, logged nothing in three runs. Against LV01b’s 1,659 bytes for a REST GET, log_statement=all on authenticator takes a request to about 6,064 bytes (3.7x) and log_min_duration_statement=0 to about 10,685 bytes (6.4x); the ratios combine figures from two modules on different projects and are derived. authenticated, service_role and database-level settings were not tested.
A role setting on postgres reached new direct sessions at once and had not reached new sessions through the shared pooler 75-453 s later. In LV02b, e and g, each “new” pooled session reported the pre-change value of the setting under test, with a backend age that grew by about 75 s per condition across all conditions, from 75 s to 453 s (run2 and run3), which fits one reused server connection, and logged nothing. When the pooler opens a fresh server connection, and the setting with it, was not measured.
alter role authenticator reset all returned OK and left log_statement=all in place, in all three runs; alter role authenticator reset log_statement removed it. At defaults RAISE NOTICE wrote nothing, because log_min_messages=warning sits above it, and RAISE LOG wrote one row per call.
When an authenticator setting takes effect
Section titled “When an authenticator setting takes effect”A role setting applies to connections opened after the change, and PostgREST serves requests from a pool of connections it keeps open.5 PostgREST documents a 30 s db-pool-max-idletime and a 1,800 s db-pool-max-lifetime;4 the values a hosted project runs are not readable from the project. Measured once each on 2026-11-10 with service_role-key traffic (LV04, LV05):
| Module | What ran | Result |
|---|---|---|
| LV05b | 8 concurrent RPC calls, then no traffic, DDL (data definition language) or NOTIFY for 330 s | the 8 pool connections stayed at all 33 samples, 0 to 327 s |
| LV04d | steady traffic (a point read about twice a second, a 300 ms RPC every 10 s), then alter role authenticator set log_min_duration_statement = '200ms' | the first duration row for the 300 ms RPC came 1,750 s later; the two pool connections were replaced at 1,792 s and 1,797 s of age |
| LV05c | the same setting under steady traffic, then notify pgrst, 'reload config' | the same 8 connections 90 s later; 0 duration rows |
| LV05d | then notify pgrst, 'reload schema' | 0 of the 8 left after 90 s; 18 duration rows from 3 s after the NOTIFY; 179 point reads and 18 RPC calls, all 200 |
| LV04e | reset log_min_duration_statement, then pg_terminate_backend on the authenticator connections from a postgres session | postgres is a member of pg_signal_backend; 2 of 2 terminated; 299 point reads and 15 RPC calls in the next 150 s, all 200; 0 duration rows from 10 s after |
Under steady traffic a setting on authenticator waited for the pool’s connection lifetime, about 30 minutes, and notify pgrst, 'reload schema' applied it within the next 90 s. The undo behaves the same way: after the reset in LV04e, connections opened since the change kept logging (6 rows in 60 s) until they were terminated. These are single runs at low request rates; the cost of reload schema on a large schema and pool behaviour at production concurrency were not measured. LV02’s 45 s idle wait applying authenticator settings is not explained by LV05b.
What the Postgres logs keep for a slow or timed-out Data API call
Section titled “What the Postgres logs keep for a slow or timed-out Data API call”With log_min_duration_statement set on authenticator, the duration row for an RPC (remote procedure call) call carried PostgREST’s statement and, in log_attributes['parsed.detail'], the bind values: Parameters: $1 = '{"ms":300}', $2 = '1000', $3 = '0' (LV05d), so request bodies reach postgres_logs. An anon-key call cancelled by the anon role’s statement timeout answered HTTP (Hypertext Transfer Protocol) 500 57014 after 3,040 ms and left one row, canceling statement due to statement timeout, with parsed.user_name authenticator, parsed.sql_state_code 57014 and the statement in parsed.query with $1 placeholders and no values (LV05a). Both measured 2026-11-10, one run each. Supabase’s timeouts guide has a Logs Explorer query that lists both kinds of row.6
Finding the slow query in a time window without a drain
Section titled “Finding the slow query in a time window without a drain”pg_stat_statements counters are cumulative, so an answer for one window needs two readings. LV03 (2026-11-09, one run, Postgres 17.11, pg_cron 1.6.4, pg_stat_statements 1.11) ran a pg_cron job every 30 seconds that copied the current database’s pg_stat_statements rows and the non-idle client backends of pg_stat_activity into tables and kept 3 hours; the SQL is SETUP in lv03-snapshot-rca.ts. Over 120 s of three concurrent loops of a slow RPC (a like '%abc%' count over 1,000,000 rows) on top of point reads, the difference between the snapshots bracketing that window put the slow RPC first, 333,978.6 ms over 485 calls, and it was not in the top 5 for the baseline window before it (LV03b). The activity snapshots caught it in flight 12 times, under usename authenticator, so the query text is what identifies the call (LV03c).
| Module | pg_stat_statements rows per snapshot | Job run time | Snapshot table bytes per snapshot |
|---|---|---|---|
| LV03d | 705.9 | 22.6 ms average, 42.8 ms max, 15 runs | about 71.5 KB (1,073,152 bytes after 15) |
| LV04f | 4,911.8 (pg_stat_statements.max 5000, filled with 6,000 distinct statements) | 82.0 ms average, 103.5 ms max, 10 runs | 453,018 |
At 30 s that is 360 snapshots per 3 hours, about 26 MB at LV03’s statement count and about 163 MB with pg_stat_statements full (derived). A stats reset or restart inside a window and the job’s effect on a busy database were not measured.
The snapshot job as one SQL file, applied with the Supabase CLI
Section titled “The snapshot job as one SQL file, applied with the Supabase CLI”LV06 (2026-11-10, one run, same setup as LV04) packages LV03’s job as one file that can be run again, templates/query_history.sql. It enables pg_cron if it is not already, creates the rca schema with three tables (stmt_snap, stmt_text, act_snap) and two functions: rca.take() writes one snapshot and deletes stmt_snap and act_snap rows older than 3 hours, and rca.top(win, n) ranks statements by execution time between the last snapshot at or before now() - win and the latest one (defaults '1 hour' and 10). It revokes the schema, its tables and its functions from public, anon and authenticated; where supabase_read_only_user exists it grants that role usage on the schema, select on its tables and execute on rca.top, which the file’s comment says is for supabase db query --read-only. The job is scheduled last:
-- Same name updates the existing job, so re-running does not add a second one.select cron.schedule('rca-snap', '30 seconds', 'select rca.take()');templates/query_history_uninstall.sql unschedules rca-snap and drops the schema. With no snapshot as old as win, the file’s comment says rca.top returns totals since the last pg_stat_statements reset; LV06 did not exercise that case.
Both files were applied with Supabase CLI 3.1.0, SUPABASE_ACCESS_TOKEN set to a personal access token and no database password, through this loop, shown without the test’s -o json || exit 1 after --yes (<name> matched one project; the uninstall passed query_history_uninstall.sql):
supabase projects list -o json | jq -r '.[] | select(.name == "<name>") | .ref' | while read ref; do supabase db query --remote="$ref" -f query_history.sql --yes; doneThe test ran the loop with sh -c, where || exit 1 ends the loop with status 1 at the first project whose db query fails; this one-project run did not take that path. For an incident, the file’s header suggests select * from rca.top('1 hour');. The fixture was a 500,000-row table, lv6_light(k) (a point read) and lv6_heavy() (a count(*) with like '%abc%'), called over the Data API with the service_role key.
| Module | What ran | Result |
|---|---|---|
| LV06a | install through the loop | exit 0; a separate select current_user through db query --yes (write mode) returned postgres; schema rca with 3 tables, 2 functions and one job, schedule 30 seconds, command select rca.take() |
| LV06b | the same install again | exit 0; 3 tables, 2 functions and 1 job |
| LV06c | 65 s wait; lv6_light about every 200 ms for 180 s, with two concurrent loops calling lv6_heavy back to back for the last 90 s; 40 s idle; then select calls, exec_ms, query from rca.top('130 seconds', 5) through supabase db query --yes | 1. lv6_heavy 162,978.1 ms over 641 calls; 2. select rca.take() 150.8 ms over 4 calls; 3. lv6_light 118.6 ms over 479 of its 894 calls (the recorded text stops before the function name; its $1 JSON parameter marks the one RPC called with an argument); all 894 lv6_light and 641 lv6_heavy calls returned 200 |
| LV06d | the same rca.top call through supabase db query --read-only | lv6_heavy first, 162,978.1 ms over 641 calls (only the first row was recorded); the role it ran as was not recorded |
| LV06e | privileges of anon, authenticated and service_role on rca; an anon-key POST to /rest/v1/rpc/top with Accept-Profile: rca and Content-Profile: rca | none of the three has usage on the schema, select on rca.stmt_snap or execute on rca.top; the POST got 406 PGRST106 (rca not in the exposed schemas), so the revokes were not what stopped it |
| LV06f | the uninstall file through the same loop, then the install file again | both exited 0; after the uninstall no rca schema and no rca-snap job; after the reinstall 1 schema, 3 tables, 1 job |
The 130 s window is the 90 s of lv6_heavy calls plus the 40 s idle after them. It starts at the last snapshot at or before 130 s ago, so earlier lv6_light calls fall outside it, which is why 479 of the 894 count. The three loop runs whose stderr was recorded (LV06a, LV06b and the LV06f uninstall) printed Cannot find project ref. Have you run supabase link? on stderr, from a CLI call outside a linked folder; the project list still printed and the loop ran. The direct supabase db query --remote calls in LV06c and LV06d did not print it.
The loop selected one project by name. To cover an organisation the jq filter would match .organization_slug, a field in the CLI 3.1.0 JSON (JavaScript Object Notation) output (checked 2026-11-10); that filter was not run, and neither was a loop over more than one project. Also not measured: a project without supabase_read_only_user, a job named rca-snap that the file did not create, other CLI versions, and the job’s cost on a busy database (LV03d and LV04f above are the cost figures).
Reading the numbers
Section titled “Reading the numbers”| Claim | Measured or documented | How it was checked |
|---|---|---|
| Per-action rows and bytes by source | measured, LV01 run1 and run2, n = 100 per row (LV01d n = 1; LV01a and LV01l one window each) | sequential actions in their own time window, rows per source minus the idle rate, size proxy from the logs endpoint |
| Edge Function rows by event type | measured, LV01 run2 | function_logs filtered on log_attributes['function_id'], grouped by event_type |
| Shutdown rows arrive up to about 3.5 minutes late | measured, exploratory, not archived | 20 invocations on a dev project, polled at 60, 180 and 300 s |
| Cached Storage reads are logged | measured, LV01j, both runs | cf-cache-status per response against edge_logs rows in the window |
| Polling at 5 s costs about 28.7 MB a day per client | derived | 17,280 requests times LV01b’s 1,659 bytes |
| Postgres settings by role and path | measured, LV02, REST three runs, direct path run3, pooler session settings run2 and run3 | postgres_logs rows in each window; each SQL session read its own current_setting and backend start |
reset all clears nothing | measured, LV02j, three runs | pg_db_role_setting read after each statement |
When an authenticator setting reaches Data API calls | measured, LV04d, LV04e, LV05b-d, one run each | authenticator backends in pg_stat_activity sampled every 10-15 s; postgres_logs duration rows per window |
| What timeout and duration rows carry | measured, LV05a, LV05d | log_attributes read from the logs endpoint |
| The snapshot difference names the slow query; snapshot cost | measured, LV03 and LV04f, one run each | top statements by difference between snapshots; cron.job_run_details durations; pg_total_relation_size |
The one-file template installs, re-runs to one job, answers rca.top in write and --read-only mode and uninstalls through the CLI | measured, LV06, one run, one project | counts of the rca schema, its tables and functions and rca-snap jobs after the loop runs (no function count after the LV06f runs); rca.top output from supabase db query; has_schema_privilege, has_table_privilege and has_function_privilege for the three Data API roles |
| A backend cache’s answered reads write no gateway row; the bucket estimate is below the live hit rate | measured, LV07a-c, one run, one 600-read trace | edge_logs rows by per-phase marker against REST calls counted in the cache’s fetchMethod |
| Concurrent misses share one fetch; delete-on-write returns fresh data | measured, LV07d, LV07e, one run | fetchMethod call count and edge_logs rows; values returned before and after cache.delete() |
Rows per auth.admin.getUserById call | measured, LV07f, LV07g, n = 50 | rows per source in the window minus the idle rate |
| Pooler rows per read with a kept pool and per new connection | measured, LV07h, LV07i, n = 200 and 30, transaction mode, log_connections not read | rows per source in the window minus the idle rate |
| Metered GB equals the proxy | not checked | metered bytes are not readable by token |
| Logs Ingest price and the settings a project owner can change | documented, read 2026-10-15 | the footnoted pages |
None of the behaviours above has been filed upstream as a docs disagreement. Every number is from one region (ap-southeast-1), Pro (LV01, LV02, LV07) and Team (LV03 to LV06) organisations, and small throwaway projects (LV01 and LV02 sent sequential single requests to a nearly empty project; LV03 to LV06 ran concurrent calls, with test tables of at most 1,000,000 rows; LV07 replayed one 600-read trace with overlapping requests), so row sizes will differ with longer URLs (Uniform Resource Locators), headers and statements; and the size proxy tracks what the logs endpoint returns, which the metered byte count may not match.
Decision guide
Section titled “Decision guide”Text version of the decision guide:
- Group the project’s rows by
sourcefirst; the lever depends on which one carries the volume. edge_logsandauth_logs: count the requests reaching the project. Per-requestgetUser(LV01h) and single-row writes (LV01c) are the measured multipliers; polling and refetching on every render follow from LV01b’s row per request and were not measured. A backend cache removes one row per read it answers (LV07a-c).function_logs: count invocations and console lines per invocation. Each ~100-character line is about 520-540 bytes; each silent call is about 3,019 bytes.postgres_logs: readpg_db_role_settingforauthenticatorandpostgres, and search hot functions forRAISE LOG. At defaults REST GETs andselectstatements wrote 0 rows here;RAISE LOGwrote 1 row per call.pgbouncer_logsand a fewpostgres_logsrows an hour with no traffic are platform background.supavisor_logs: count client connections to the shared pooler; a connection per read wrote 4.1 rows and 2924 bytes each (LV07i), a kept pool 3 rows per 200 reads (LV07h).
What to do about it
Section titled “What to do about it”| Practice | Evidence | Module |
|---|---|---|
Group logs by source before changing anything. | Each source has a different lever; the gateway, function and Postgres rows above move independently. | LV01, LV02 |
| Replace polling with Realtime where updates are pushed. | A REST GET is about 0.9 edge_logs rows and 1,659 bytes; 100 broadcast messages wrote none. | LV01 b, k |
| Batch writes into one request. | 100 single-row inserts produced 91 edge_logs rows (run2); one 100-row insert produced 1. | LV01c, LV01d |
Verify auth with getClaims() on projects with asymmetric signing keys. | getUser wrote 2,604 bytes per call; getClaims wrote 27 bytes per call (2 rows per 100 calls). | LV01h, LV01i |
| Cache in the client or app; do not rely on the Storage CDN to cut logs. | 99 CDN cache hits of 100 still produced 90-99 edge_logs rows; a backend cache measured in LV07, a client cache not measured. | LV01j |
| Cache hot reads in the backend with a lifetime; answered reads write nothing. | 600 uncached reads wrote 600 edge_logs rows; 5 s and 30 s caches made 154 and 40 REST calls that wrote 154 and 40 edge_logs rows. | LV07 a-c |
Use a cache that merges concurrent misses for one key, such as lru-cache fetch(). | 50 concurrent fetches for one key on an empty cache made 1 REST call and wrote 1 edge_logs row. | LV07d |
| Clear the entry when the backend writes the row it caches. | A read after a PATCH returned the old value until cache.delete(), the new one after. | LV07e |
Cache auth.admin.getUserById per user id. | Each call wrote an edge_logs row (2015 bytes) and an auth_logs row (789 bytes); 50 cached lookups made 1 call. | LV07f, LV07g |
| Read Postgres over a kept pool, not a new connection per query. | 200 pooled reads wrote 3 supavisor_logs rows; a connection per read wrote 4.1 supavisor_logs rows and 2924 bytes per connection, above a REST GET’s 1659 bytes (LV01b). | LV07h, LV07i; LV01b |
Estimate a cache’s saving from edge_logs and read it as a lower bound. | The bucket estimate from the logged rows gave 0.682 and 0.92 where the cache hit 0.743 and 0.933 on the same trace; one trace. Per-user keys under RLS (row-level security) can make it too high. | LV07a-c; guide |
Gate Edge Function console.log behind a debug flag. | Each ~100-character line added about 520-540 bytes; a silent call wrote about 3,019. | LV01e-g |
Count Edge Function rows by function_id, not by time window. | Shutdown rows landed up to about 3.5 minutes late; the windowed count was 0.98 function_logs rows per call in run1 against 1.9 by id in run2. | LV01e, run1 and run2 |
Check authenticator role settings when postgres_logs are large. | log_statement=all there added 4,405 bytes per request; the same on anon added nothing. | LV02 c, d, f |
Reset each role setting by name; reset all clears nothing. | On authenticator, reset all returned OK and left log_statement=all in place in three runs; other roles not tested. | LV02j |
| Expect pooled sessions to keep an old role setting for a while. | Pooled sessions reported the pre-change value with backend ages of 75-453 s; new direct sessions took the new one. | LV02b, e, g |
After setting or resetting a role setting on authenticator, run notify pgrst, 'reload schema'. | Under steady traffic the setting first logged 1,750 s after the alter role; after reload schema it logged within 90 s with no failed request. reload config replaced no connection. | LV04 d, LV05 c, d |
Treat log_min_duration_statement on authenticator as logging request bodies. | Duration rows carried the RPC’s bind values in parsed.detail. | LV05d |
Find Data API timeouts by the statement timeout message and parsed.user_name. | A cancelled call left one row with the statement in parsed.query and user authenticator. | LV05a |
For “which query, in this window” without a drain, snapshot pg_stat_statements with pg_cron and diff two snapshots. | The slow RPC ranked first in its window and outside the baseline top 5; 22.6-82.0 ms per run and about 71.5-453 KB per snapshot from about 700 to about 4,900 statements. | LV03 b, d; LV04f |
Roll the snapshot job out with supabase db query -f in a projects list loop. | With a personal access token and no database password, CLI 3.1.0 installed query_history.sql, re-ran it (still 1 job), read rca.top in write and --read-only mode and removed it; lv6_heavy ranked first, 162,978.1 ms over 641 calls. One project in the loop; a filter on organization_slug and more projects not run. | LV06 a-f |
Use RAISE LOG only where every call should leave a row. | 1 row, 1,336 bytes per call; RAISE NOTICE wrote nothing at defaults. | LV02h, LV02i |
| Read per-request row counts as 0.83-0.97 of the requests sent. | 84 and 92 of 100 marked REST GETs had an edge_logs row; LV01h run1 had 83; unexplained. | LV01b, LV01h |
Modules
Section titled “Modules”Each row links the redacted run artifacts published to out/, in run order. LV02 run1 and run2 ran earlier revisions of the test (no direct path in run1, a failed direct path in run2); the figures and that history are in the experiment’s RUNLOG.
| Module | Experiment | Test | Artifact |
|---|---|---|---|
| LV01 | logs-volume | lv01-request-footprint.ts | run-2026-10-15T00-48-12-600Z, run-2026-10-15T01-20-10-706Z |
| LV02 | logs-volume | lv02-postgres-knobs.ts | run-2026-10-15T00-48-17-483Z, run-2026-10-15T01-03-02-840Z, run-2026-10-15T01-20-48-490Z |
| LV03 | logs-volume | lv03-snapshot-rca.ts | run-2026-11-09T22-42-25-880Z |
| LV04 | logs-volume | lv04-pool-and-snapshot-limits.ts | run-2026-11-10T00-04-13-049Z (LV04b invalid: called before the schema cache had the function) |
| LV05 | logs-volume | lv05-pool-flush-and-timeout-log.ts | run-2026-11-10T00-53-56-452Z |
| LV06 | logs-volume | lv06-cli-template.ts | run-2026-11-10T03-58-44-175Z |
| LV07 | logs-volume | lv07-backend-cache.ts | run-2026-11-19T07-03-49-866Z |
Related docs
Section titled “Related docs”- Estimate a backend read cache’s effect on logs ingest: the bucket method from LV07, rewritten per path and query string for a project’s own
edge_logs, step by step. - Supabase observability surface: the log sources, ingestion lag and the 401 on the usage route that make the size here a proxy.
- Query Supabase project logs through the Management API: the query shape used to count rows by
sourceandfunction_id. - Per-project cost attribution: where a logs line fits in a per-project cost breakdown.
- Edge Function limits: the worker lifecycle behind the Boot and Shutdown rows.
References
Section titled “References”-
Supabase, “Manage Logs Ingest usage,” Supabase Docs. https://supabase.com/docs/guides/platform/manage-your-usage/logs-ingest ↩ ↩2
-
Supabase, “Creating a Supabase client for SSR,” Supabase Docs. https://supabase.com/docs/guides/auth/server-side/creating-a-client ↩
-
Supabase, “Customizing Postgres configs,” Supabase Docs. https://supabase.com/docs/guides/database/custom-postgres-config ↩
-
PostgREST, “Configuration,” PostgREST Docs. https://docs.postgrest.org/en/stable/references/configuration.html ↩ ↩2
-
PostgREST, “Connection Pool,” PostgREST Docs. https://docs.postgrest.org/en/stable/references/connection_pool.html ↩
-
Supabase, “Timeouts,” Supabase Docs. https://supabase.com/docs/guides/database/postgres/timeouts ↩