Supabase and PostgresDatabase and Postgresreference
PostgREST retries of an RPC that raises 40001
A claim that circulates about the Supabase Data API (application programming interface) says PostgREST treats 40001 as transient, so a function that raises it loops, fills the log volume and, when the function takes row locks, grows pg_multixact. This page tests the claim on a local rig. It covers whether the request transaction is retried, how often and for how long, what each attempt costs in server log bytes and in pg_multixact, which PostgREST versions do it, and what ends the loop. The retry matters beyond a deliberate raise: PostgREST’s retry of genuine serialization conflicts is what the read-replica results on Supabase read replicas lean on as an inference.
TL;DR
- A function-raised
40001loops on PostgREST 12.2.12, 13.0.8 and 14.18: no answer, 7,746 to 25,844 attempts in the 5 s before the client gave up, and the loop kept going after the client left. With the client gone and server logging atfatal, the counters at 30, 60, 90 and 120 s were 147,596 / 301,166 / 439,718 / 593,988 (12.2.12), 156,182 / 283,682 / 334,465 / 417,810 (13.0.8) and 208,741 / 439,628 / 646,858 / 867,021 (14.18) (RS01). The binaries carry hasql-transaction 1.0.1.4, whose retry loop has no counter and no delay. - PostgREST 16.0 and 16.6 answer HTTP (Hypertext Transfer Protocol) 500 with code
40001after one attempt, in 2 to 3 ms (RS01). The change is in the 16.0 release notes and its pull request.12 - Each failed attempt writes about 800 to 960 bytes of Postgres log (an
ERROR, aCONTEXTand aSTATEMENTrecord) at the image’s logging: 957 bytes per failed attempt ofrs_flakyand 800 forrs_raise_40001, 2.1 to 3.1 MB per second of loop on the rig host (RS02). pg_multixactgrows by one MultiXactId per attempt only when another transaction holdsFOR SHAREorFOR KEY SHAREon the same rows: 1 per entry in every such trial; a lone looping caller created none in 3 of 3 trials (43,550 to 46,423 entries each) (RS03).- Any other SQLSTATE answers once on every version:
P0001as HTTP 400,23505as 409,PT402as 402,40P01,40000,55P03and57014as 500 with that code. A genuine serialization conflict is retried and absorbed on 12.2.12 to 14.18 and is an HTTP 500 with code40001from 16.0 (RS04). - The loop outlives its client and the role’s 3 s
statement_timeout. What ended it was terminating the request’s Postgres backend or stopping PostgREST; loops whose clients were gone held a pool of 2 until an unrelated request got504 PGRST003(RS01).
Which do I pick
Section titled “Which do I pick”| Situation | Choice | Why |
|---|---|---|
| A function needs to tell the client “try again” | Raise a different SQLSTATE: PT409 or P0001 | Answered once on all five versions (RS04) |
A 40001 loop is running on 12.2.12 to 14.18 | pg_terminate_backend on the request’s backend, or stop PostgREST | 0 further entries in the next 2 s and 1.5 s (RS01 arm d) |
| The loop’s log volume is the problem | ALTER ROLE authenticator SET log_min_messages = 'fatal', or log_min_error_statement | 0 bytes and 216 bytes per attempt against 957 (RS02) |
| The function takes row locks other sessions also take | Fix the loop first; treat pg_multixact growth as proportional to attempts | 1 MultiXactId per attempt with a second locker (RS03) |
| You depend on retries of genuine serialization conflicts | Add client-side retry before PostgREST 16.0 | 16.0 and 16.6 return the conflict as HTTP 500 40001 (RS04) |
| Which build runs on a managed project | Check the version before choosing | The last recorded managed build is 14.18 (2026-11-10); the current one is not known |
The same flow as text:
- A function called over
POST /rpc/<name>raises a SQLSTATE. - Any code other than
40001is answered once and mapped to an HTTP status. 40001on 12.2.12, 13.0.8 or 14.18 retries the transaction with no bound seen; on 16.0 or 16.6 it answers HTTP 500 with code40001after one attempt.- The retrying loop outlives the client and the role’s
statement_timeout. - It ends when the request’s backend is terminated or PostgREST stops.
Where the retry lives
Section titled “Where the retry lives”The PostgREST sources and release notes were read for the lab run on 2026-12-03 and are cited here as that reading, not re-read for this page.
- PostgREST issue 3673, “Surprising infinite retrying of SQL statement on a replica causes replication lag,” and pull request 4222, “fix: do not retry transactions on
40001SQL error,” merged 2026-04-27. The diff swapsSQL.transactionforSQL.transactionNoRetryinMainTx.hsand the schema cache and config queries, and adds a replica test that expects HTTP 500 with code40001.32 - The v16.0 release notes (2026-08-07) read “Fix automatic transaction retries on
40001 (serialization_failure)errors to prevent replication lag”. No release note of v14.0 to v14.18 or v16.1 to v16.6 contains40001orserializ(26 release bodies grepped). Only release notes were searched, not the commit history, so a backport that the notes omit is not excluded; the 14.18 binary retries (RS01).1 - The request transaction call sites: v12.2.12
src/PostgREST/Query.hsline 81 and v13.0.8 line 88 (transaction = if prepared then SQL.transaction else SQL.unpreparedTransaction); v14.18src/PostgREST/MainTx.hsline 101 (same expression); v16.0src/library/PostgREST/MainTx.hsline 89 and v16.6 line 96 (SQL.transactionNoRetry isoLvl txMode ...). - hasql-transaction 1.0.1.4 (
library/Hasql/Transaction/Private/Sessions.hs):inRetryingTransactionisfix $ \retry -> do ... Nothing -> retry, with no counter and no delay, andhandleTransactionErrorretries when the server error code is"40001"and rethrows anything else. Version 1.1 added a"40P01"clause (its changelog reads “Add automatic retry on deadlock errors (code 40P01)”). hasql-transaction 1.2.1 exportstransactionNoRetry.4 - Which hasql-transaction each image carries was measured (RS00), because the 14.18 source tree’s Nix overlay names 1.1.0.1 and the shipped binary does not carry it:
docker cpof/bin/postgrestand a search for the stringhasql-transaction-<version>found 1.0.1.4 in 12.2.12, 13.0.8 and 14.18, and 1.2.1 in 16.0 and 16.6.
The image’s logging as shipped (RS00, from pg_settings): logging_collector off, log_destination stderr, log_line_prefix %h %m [%p] %q%u@%d (compiled-in %m [%p] ), log_min_messages warning, log_min_error_statement error, log_error_verbosity default, and log_statement ddl for the postgres and authenticator roles. autovacuum_multixact_freeze_max_age is 400000000 and max_connections 100. Role settings in the image: anon statement_timeout=3s, authenticated and authenticator statement_timeout=8s (authenticator also lock_timeout=8s), service_role none.
An RPC that always raises 40001 (RS01)
Section titled “An RPC that always raises 40001 (RS01)”Setup: rs_raise_40001() does perform nextval('public.rs_attempts') and then raise exception 'try again' using errcode = '40001', called as POST /rpc/rs_raise_40001 with no JWT (role anon). The sequence is not rolled back, so it counts entries into the function. Arm a: the client gives up after 5 s, the counter is read for 8 more seconds, then PostgREST is killed.
| PostgREST | Client | Entries when the client gave up (3 trials) | Entries in the next 8 s | Counter still rising at the end |
|---|---|---|---|---|
| 12.2.12 | no answer, client timeout at 5.0 s, 3 of 3 | 23,149 to 24,938 | 34,951 to 39,523 | 3 of 3 |
| 13.0.8 | no answer, 3 of 3 | 18,567 to 25,844 | 27,674 to 35,493 | 3 of 3 |
| 14.18 | no answer, 3 of 3 | 7,746 to 21,044 | 29,044 to 36,463 | 3 of 3 |
| 16.0 | HTTP 500, code 40001, after 2 to 3 ms, 3 of 3 | 1 | 0 | 0 of 3 |
| 16.6 | HTTP 500, code 40001, after 2 to 3 ms, 3 of 3 | 1 | 0 | 0 of 3 |
At the end of the 8 s, pg_stat_activity showed two request backends on the retrying versions and one idle backend on 16.0 and 16.6. The looping backend was in a different phase of its BEGIN, call, ABORT cycle at each look (active, idle, idle in transaction, idle in transaction (aborted)), so the state at one instant says nothing; the rising counter is the evidence.
- Three independent counts agree. In all 9 retrying trials the entries counted by the sequence equal the
ERROR: try againlines in the Postgres log, andpg_stat_database.xact_rollbackrose by the same number or one more (14.18, trial 1: 54,403 entries, 54,403 log lines, 54,404 rollbacks). One failed attempt is one rollback. - Rate in the first 5 s, 3 trials: 12.2.12 4,630 to 4,988 entries a second, 13.0.8 3,713 to 5,169, 14.18 1,549 to 4,209. That is a host figure; the loop has no pause of its own.
- No bound on the attempt count: 14.18 reached 864,953 entries at 120 s with the client still waiting (arm
e_wait, one run, client timeout at 125,001 ms, no response). With the client gone after 5 s (arme_gone, one run per version,log_min_messagesset tofatalso the loop does not fill the host) the counters at 30 / 60 / 90 / 120 s were 147,596 / 301,166 / 439,718 / 593,988 (12.2.12), 156,182 / 283,682 / 334,465 / 417,810 (13.0.8) and 208,741 / 439,628 / 646,858 / 867,021 (14.18). - The loop outlives the client. In arm a the counter kept rising for the whole 8 s after the client gave up, in 9 of 9 retrying trials. A raw TCP (Transmission Control Protocol) socket closed by the client after 2 s (arm d1, one run per version, so the result does not depend on how
fetchaborts) did the same: 9,380 / 7,301 / 7,027 entries when the socket closed and 14,390 / 10,294 / 7,613 more in the next 3 s (12.2.12 / 13.0.8 / 14.18); no response bytes were received. - Role timeouts do not end it. The requests ran as
anon, whosestatement_timeoutis 3 s, and the loop ran 120 s, because each attempt is a new transaction and the timer restarts. The 8 s ofauthenticatedwas not measured (no JWT was configured). - What ends it (arm d, one run per retrying version):
pg_terminate_backendon the request backend (1 backend terminated in each) gave 0 entries in the next 2 s; killing PostgREST gave 0 in the next 1.5 s. The first unrelated request after the termination answered 200 (12.2.12, 14.18) or503 PGRST001after 1 ms (13.0.8); one request each, so no version difference is claimed. - A bounded loop looks like success to the client.
rs_flaky(k)fails the first k entries and then returns: k = 5 and k = 100 answered HTTP 200 in 4 to 6 ms and 25 to 46 ms on the retrying versions, with 6 and 101 entries (log lines 5 and 100). On 16.0 and 16.6 the same call is HTTP 500, code40001, 1 entry, in 2 to 4 ms. GETof aSTABLEfunction raising40001(arm c; read-only transaction, so no counter; counted byxact_rollback, equal to the log lines): 11,515 / 12,461 / 9,766 rollbacks in the 3 s before the client gave up on 12.2.12 / 13.0.8 / 14.18; 1 on 16.0 and 16.6 (HTTP 500, code40001).- Unrelated requests. With the default pool of 10, one looping request did not stop an unrelated
POST /rpc/rs_pingfrom answering 200 in 6 to 11 ms on the retrying versions (2 s into the tail, 9 of 9). With a pool of 2 (PGRST_DB_POOL=2, acquisition timeout 3 s), two looping requests whose clients had given up after 1 s held both connections: the unrelated request got504 PGRST003after 3,002 to 3,004 ms in 9 of 9 trials on 12.2.12, 13.0.8 and 14.18, and HTTP 200 in 2 to 4 ms in 6 of 6 on 16.0 and 16.6. A pool of 2 is a local choice to make the exhaustion visible; with the default pool of 10 the same would take ten looping requests, which was not run. - CPU, one sample 2 s into the tail of the 14.18 trial 1, as
docker statsreports: 46.43% (Postgres container) and 35.17% (PostgREST container) of one core.
Log bytes (RS02)
Section titled “Log bytes (RS02)”Measured as the growth of the Postgres container’s stderr, image logging as shipped unless a row says otherwise. Each failed attempt writes three records: ERROR, CONTEXT and STATEMENT (the whole statement PostgREST generated). n = 3 per arm, the same value in each.
| Arm | Result |
|---|---|
rs_flaky(k), retrying versions, k = 0 | 0 bytes, HTTP 200 (a successful call logs nothing at these settings) |
| k = 10 / 100 / 1000 on 13.0.8 and 14.18 | 9,570 / 95,700 / 957,000 bytes per request, 957.0 bytes per failed entry |
| k = 10 / 100 / 1000 on 12.2.12 | 9,590 / 95,900 / 959,000 bytes, 959.0 per failed entry |
| 16.0, 16.6, any k | 957 bytes per request: one failed entry, HTTP 500 |
rs_raise_40001 loop for 4 s, then PostgREST killed | 802.0 (12.2.12) and 800.0 (13.0.8, 14.18) bytes per entry |
| The same loop, bytes per second in the first 4 s | 2,123,696 to 2,697,928 (12.2.12), 2,506,400 to 3,116,800 (13.0.8), 2,521,600 to 3,113,600 (14.18) |
The per-entry figure depends on the statement text: rs_flaky(k) takes a parameter and its generated statement is longer than rs_raise_40001()’s. The log lines the loops wrote equal the entries the sequence counted, checked per trial.
Other logging settings, 14.18 only, rs_flaky(200), applied with ALTER SYSTEM and reset after each arm:5
| Setting | Bytes per request | Per failed entry |
|---|---|---|
| as shipped | 191,400 by multiplication from 957.0, not a run | 957.0 |
compiled-in log_line_prefix and log_statement (%m [%p] , none) | 171,000 | 855.0 |
log_statement = all | 573,301 | 2,866.5 |
log_min_error_statement = panic (no STATEMENT record) | 43,200 | 216.0 |
log_error_verbosity = terse | 165,400 | 827.0 |
alter role authenticator set log_min_messages = 'fatal' run as postgres, on new PostgREST connections | 0 (ALTER ROLE returned ok; 0 ERROR lines) | 0 |
Computed from the loop rows, not measured: 2,521,600 to 3,113,600 bytes a second is 9.1 to 11.2 GB an hour and 218 to 269 GB a day on this host; an unpublished smoke run of the same loop while 11 containers ran on the host moved 496,062 bytes a second. Neither figure is a volume fill: no run wrote into a volume of a stated size. The platform’s log pipeline, shipping, rotation and retention, and disk usage of a managed project, were not measured. The lab’s logs-volume experiment recorded that a role setting reaches pooled PostgREST connections only after they are replaced (about 1,750 s) or after notify pgrst, 'reload schema'; see Supabase log volume per request.
pg_multixact (RS03)
Section titled “pg_multixact (RS03)”Server logging at fatal for the module (it changes no locking). n = 3 per arm; the client gives up after 6 s, PostgREST is killed, counters read 2.5 s later. MultiXactIds created is the rise of mxid_age(datminmxid). PostgREST 14.18.
| Arm | Entries (3 trials) | MultiXactIds created | Per entry |
|---|---|---|---|
A: rs_share_raise (FOR SHARE on 10 rows, then raise 40001), nobody else locking | 43,550 to 46,423 | 0 | 0 |
B: the same, a separate session holds FOR SHARE on the same 10 rows in an open transaction | 45,915 to 46,413 | 45,915 to 46,413 | 1 |
B2: rs_keyshare_raise (FOR KEY SHARE), a session holds FOR KEY SHARE | 42,843 to 44,951 | 42,843 to 44,951 | 1 |
C: two simultaneous requests of rs_share_raise, nobody else | 67,062 to 69,146 (both loops) | 2,642 to 3,373 | 0.046 |
| D: control, the holder session only, no request | 0 | 0 | n/a |
E: rs_share_flaky(20000) against a FOR SHARE holder, ends by itself (HTTP 200 after 20,001 entries; 2 trials) | 20,001 | 20,001 | 1 |
- A second locker is what makes the MultiXact. A single looping caller on rows nobody else locks created none in 3 of 3 trials; with another transaction holding the same row locks, every entry created one MultiXactId (B, B2 and E: 1 per entry in every trial). Two looping callers overlapped often enough to create 0.046 per entry (2,642 to 3,373 per trial); a superseded first run measured 0.126 to 0.129 for the same arm, so the overlap rate moves between runs and is not a constant.
- Rate: B and B2 created 7,139 to 7,733 MultiXactIds a second on this host. Computed, not measured:
autovacuum_multixact_freeze_max_ageof 400000000 at that rate is 0.6 days of such a loop. What happens when the limit is reached was not run.6 - Directory sizes (
du -sbinside the container), arm E trials 1 and 2: 20,001 MultiXactIds grewpg_multixact/offsetsby 81,940 and 81,920 bytes (4.1 per MultiXactId) andpg_multixact/membersby 204,820 and 196,628 bytes (9.8 to 10.2 per MultiXactId, two members each). The cached pages (simple least-recently-used (SLRU) buffers) are written lazily, so the per-arm growth of arms A to D lags the counters; the directories only grow, from 8,252 to 2,941,208 bytes (members) and 1,155,212 (offsets) over all arms. - WAL (write-ahead log): the insert position moved about 605 bytes per entry in arm A (no MultiXact; the 605 was not broken down) and about 661 in B, B2 and E, a difference of roughly 56 with a MultiXact. A side measurement.
- On 16.6 each request is one entry: arm A 0 MultiXactIds, B and B2 1, C 0 (n = 3 per arm), so nothing accumulates there.
Genuine conflicts and other codes (RS04)
Section titled “Genuine conflicts and other codes (RS04)”n = 3 per arm and version.
| Call | 12.2.12, 13.0.8, 14.18 | 16.0, 16.6 |
|---|---|---|
rs_raise('40001') (RAISE in the function) | no answer inside 2.5 s, 6,887 to 9,553 entries per trial | HTTP 500, code 40001, 1 entry |
rs_raise('40P01') | HTTP 500, code 40P01, 1 to 2 ms, 1 entry | same |
40000, 55P03, 57014 | HTTP 500 with that code, 1 entry | same |
P0001 (RAISE’s default) | HTTP 400, code P0001, 1 entry | same |
PT402 | HTTP 402, code PT402, 1 entry | same |
SQLSTATE 'PGRST' with JSON (JavaScript Object Notation) message and detail | HTTP 402, code RS402 (the body’s own code), 1 entry | same |
23505 | HTTP 409, 1 entry | same |
40001 caught in a nested block, re-raised as PT409 | HTTP 409, code PT409, 1 entry | same |
genuine write skew, two simultaneous SERIALIZABLE requests (each reads, sleeps 1 s, writes) | both HTTP 200, 3 entries in 3 of 3 trials: the loser at 2,003 to 2,009 ms against 1,002 to 1,007 ms for the winner | one HTTP 200 and one HTTP 500 code 40001 after 1,003 to 1,008 ms, 2 entries, 3 of 3 |
genuine REPEATABLE READ concurrent update (a row another session updated, then committed) | HTTP 200 after 1,502 to 1,504 ms, 2 entries, 3 of 3 | HTTP 500 code 40001 after 1,503 ms, 1 entry, 3 of 3 |
- Every 200 body of the genuine-conflict calls reported the isolation level the function asked for (
serializable,repeatable read) throughcurrent_setting('transaction_isolation'), on all five versions, so the function-levelSET default_transaction_isolationtook effect. 40P01was not retried by any version in the list. hasql-transaction 1.1 added a retry on40P01; the three retrying binaries carry 1.0.1.4, which retries40001only, and a function-raised40P01answered once on all five versions. A deadlock detected by the server was not run (RS04 raises the code from the function), so whether the same holds for one is not claimed.- What stops the loop from the function side, measured: any other SQLSTATE, a
PTxyzcode, a customPGRSTerror, or the nested-block catch with a re-raise. A genuine conflict was retried on the retrying versions in both conflict arms; the module did not separate a conflict raised inside the function from one raised atCOMMIT, and did not try catching a genuine one in the function.
What was not measured
Section titled “What was not measured”- The managed API gateway: what it does with a request that never answers and whether it closes the connection to PostgREST. The lab’s data-api-capacity DC12d recorded
504upstream request timeoutafter 125,055 to 125,066 ms for a request queued behind a held pool, with 2 PostgREST log lines forGET,HEADandPATCHand 0 forPOST /rpc; that is a different wait and is not evidence for a looping function. - The platform’s PostgREST build, a hosted project’s log pipeline and volume, replicas, and a replica’s recovery-conflict cancel against any PostgREST version.
- The freeze-age limit being reached, vacuum’s effect on the
pg_multixactdirectories, other row counts per call, and foreign-key-drivenFOR KEY SHARE. - A deadlock detected by the server; the
authenticatedrole’s 8 sstatement_timeoutunder a loop. - A loop with ten requests against the default pool of 10.
Reading the numbers
Section titled “Reading the numbers”- Rates move with the host: the VM was shared with other lab workers, so attempts a second and bytes a second differ by up to 4 times between runs of the same arm. Per-attempt log bytes and MultiXactIds per attempt do not.
- “No answer in 5 s” means the client timeout fired; the loop is shown by the sequence counter, the Postgres log lines and
xact_rollback, which agree in all 9 retrying trials. - The
e_gonecounters ran withlog_min_messagesatfataland one run per version, so they say there was no bound within 120 s, not that none exists. - One superseded RS01 run had three negative error-line cells because the Postgres container’s Docker log hit its 100 MB cap between two reads; the cited re-run raised the cap to 400 MB and marks such a cell “not counted” (none was needed). A first attempt at the whole battery in one probe hung inside RS02 for 11 minutes and wrote no artifact. One superseded RS03 run measured 0.126 to 0.129 MultiXactIds per entry in arm C against 0.039 to 0.049 in the cited run (the published 0.046 is within the cited run’s range).
What to do about it
Section titled “What to do about it”| Practice | Evidence | Module |
|---|---|---|
Raise PT409 or P0001, not 40001, for a business retry signal | PT409 and P0001 answered once with HTTP 409 and 400 on all five versions; 40001 looped on three | RS04 |
| Terminate the looping request’s backend to stop a loop | pg_terminate_backend gave 0 entries in the next 2 s; killing PostgREST 0 in 1.5 s; the client leaving and the 3 s role timeout did not end it | RS01 (arm d) |
Quiet the log with a role setting on authenticator | log_min_messages = 'fatal': 0 bytes; log_min_error_statement = panic: 216 against 957 bytes per attempt | RS02 |
| Apply a log role setting and reload the schema cache | The lab’s logs-volume runs recorded a role setting reaching pooled connections after about 1,750 s or after notify pgrst, 'reload schema' | logs-volume LV04d and LV05d (not re-run here) |
Move to PostgREST 16.0 or later for no retry of 40001 | 16.0 and 16.6: HTTP 500 40001 after one attempt, 3 of 3 each; whether the platform does is not known | RS01, RS04 |
| Retry a genuine conflict in the client from 16.0 | The loser answered HTTP 500 code 40001 after 1,003 to 1,008 ms (SERIALIZABLE) and 1,503 ms (REPEATABLE READ) on 16.0 and 16.6; 12.2.12 to 14.18 absorbed it | RS04 |
Do not call a loop’s status from one pg_stat_activity look | The looping backend moved through active, idle, idle in transaction and idle in transaction (aborted); the sequence counter is the evidence | RS01 |
Read xact_rollback and the sequence of a suspect function | Entries, ERROR log lines and rollbacks agreed in all 9 retrying trials | RS01 |
Watch pg_multixact where a retried function locks rows other sessions lock | 1 MultiXactId per attempt with a second locker, 7,139 to 7,733 a second; none for a lone caller | RS03 |
Reproducing
Section titled “Reproducing”The experiment is experiments/rpc-serialization-retry in supabase-lab. It needs Docker, the Postgres image (1.3 GB) and the five PostgREST images (20 to 520 MB each).
make all # every module, one probe each, then publish (about 30 minutes)make probe ONLY=RS01 RS_VERSIONS=14.18 # one module, one versionmake facts # measurements of the newest run as markdownEvidence
Section titled “Evidence”| Claim | Status | How it was checked |
|---|---|---|
A function-raised 40001 is retried with no bound seen on 12.2.12, 13.0.8, 14.18 and answered once by 16.0, 16.6 | measured, local Docker, n = 3 per arm | RS01, facts |
| Which hasql-transaction each binary carries | measured by string search in /bin/postgrest | RS00, facts |
| Log bytes per failed attempt, other log settings | measured, n = 3, identical values | RS02, facts |
| MultiXactIds per attempt with and without a second locker | measured, n = 3, 14.18 and 16.6 | RS03, facts |
Other SQLSTATEs answer once; genuine conflicts retried up to 14.18, HTTP 500 40001 from 16.0 | measured, n = 3 per arm and version | RS04, facts |
| The retry was removed in 16.0 | documented; consistent with RS01 and RS0412 | release notes and pull request, read 2026-12-03 for the lab run |
| A backport in 14.x or 16.x not named in the notes | not excluded by the notes; the 14.18 binary retries | release notes searched, not the commit history |
| The managed platform’s build and gateway behaviour | not measured | last recorded build 14.18 (2026-11-10) |
One docs-versus-runtime point, not filed upstream (filed: no): the lab’s earlier read-replica write-up inferred that PostgREST before 16.0 retries a replica’s recovery conflict; this experiment measured the retry for a function-raised 40001 and for genuine conflicts on a primary, not for a replica’s recovery conflict.
Modules
Section titled “Modules”| Module | Experiment | Test | Artifact |
|---|---|---|---|
| RS00 | rpc-serialization-retry | rs00-inventory.ts | run-2026-12-03T07-00-26-274Z |
| RS01 | rpc-serialization-retry | rs01-retry.ts | run-2026-12-03T07-25-45-718Z |
| RS02 | rpc-serialization-retry | rs02-log-volume.ts | run-2026-12-03T07-15-47-485Z |
| RS03 | rpc-serialization-retry | rs03-multixact.ts | run-2026-12-03T07-42-35-415Z |
| RS04 | rpc-serialization-retry | rs04-contrast.ts | run-2026-12-03T07-23-51-157Z |
| LV04d, LV05d (cited) | logs-volume | not re-read for this page | RUNLOG |
Related docs
Section titled “Related docs”- Supabase read replicas - the replica
40001conflicts that PostgREST’s retry would absorb before 16.0, cited there as RS01 and RS04 rows. - Supabase log volume per request - what a request costs in log bytes and how a role setting reaches pooled PostgREST connections.
- Supabase Data API connection pool and capacity - the pool and
PGRST003behaviour a held connection leads to. - Postgres MultiXact SLRU contention - what a MultiXact costs once many sessions lock one row.
- Postgres lock queue behind ACCESS EXCLUSIVE, lock_timeout and PgBouncer - a
55P03fromlock_timeoutis answered once here (RS04) and is a retryable error in the migration loop there.
References
Section titled “References”-
PostgREST, “v16.0,” GitHub Releases, 2026-08-07. https://github.com/PostgREST/postgrest/releases/tag/v16.0 ↩ ↩2 ↩3
-
PostgREST, “fix: do not retry transactions on 40001 SQL error,” pull request 4222, GitHub, merged 2026-04-27. https://github.com/PostgREST/postgrest/pull/4222 ↩ ↩2 ↩3
-
PostgREST, “Surprising infinite retrying of SQL statement on a replica causes replication lag,” issue 3673, GitHub. https://github.com/PostgREST/postgrest/issues/3673 ↩
-
Nikita Volkov, “hasql-transaction,” GitHub (
library/Hasql/Transaction/Private/Sessions.hs,inRetryingTransactionandhandleTransactionError). https://github.com/nikita-volkov/hasql-transaction ↩ -
PostgreSQL Global Development Group, “Error Reporting and Logging,” PostgreSQL 17 Documentation,
log_min_messages,log_min_error_statement,log_error_verbosity,log_statement. https://www.postgresql.org/docs/17/runtime-config-logging.html ↩ -
PostgreSQL Global Development Group, “Automatic Vacuuming,” PostgreSQL 17 Documentation,
autovacuum_multixact_freeze_max_age. https://www.postgresql.org/docs/17/runtime-config-autovacuum.html ↩