Supabase and PostgresDatabase and Postgresreference
Postgres lock table capacity and out of shared memory (53200)
Postgres answers 53200 out of shared memory with a hint that names a setting, and the setting is one of two: max_locks_per_transaction for the shared lock table, max_pred_locks_per_transaction for the predicate-lock table that SERIALIZABLE transactions use. This page measures how many tables each of four operations survives at the platform’s max_connections and at the default and a raised max_locks_per_transaction, and what the error says. The four modelled failures are a major-upgrade step that changes the owner of every object in one transaction, a logical restore of a schema with many tables, a database reset that drops many tables in one transaction, and a SERIALIZABLE workload that exhausts predicate locks.
TL;DR
- The shared lock table is not at the documented size. At
max_connections90 andmax_locks_per_transaction64 one transaction took 12,016 advisory locks before53200; the documented formula gives 5,760 (LT02-cal,sb17). The measured capacity was 1.69 to 2.09 times the formula atmax_locks_per_transaction64 to 256 (derived from the table below), and it rose with both terms of the formula. - The number of lock entries each table needs sets the limit. A plain table (identity primary key, TOAST (The Oversized-Attribute Storage Technique) table) takes 5 entries in
CREATE TABLE,ALTER TABLE ... OWNER TOandREASSIGN OWNED, and 8.02 inDROP SCHEMA ... CASCADE. At capacity 12,016 the highest passing N was 2,401 tables for the first three and 1,497 for the drop; the predicted N matched within 3 tables on every configuration that reached a failure, except one cell on the 15.14 image (2,368 predicted, 2,376 measured) (LT02). - A restore of a schema-only dump in one transaction failed at 2,350 to 2,400 tables with
psql --single-transactionand withpg_restore --single-transaction;pg_dumpitself passed 11,850 and failed at 11,900 (LT02d, LT02e). - The 17.11 minor takes 7 entries per
CREATE TABLE, not 5:stock17andsb17bcreated 1,722 and 1,715 tables wheresb17(17.6) created 2,401 (LT02). - Raising
max_locks_per_transactionfrom 64 to 256 took every failure point from 2,401 to 8,996 tables (3.75 times) atmax_connections90, andshared_memory_sizefrom 173MB to 181MB. It has contextpostmaster, so it needs a restart; the non-superuserpostgresrole cannot set it byALTER SYSTEM,ALTER ROLEorSET(LT01). - A SERIALIZABLE transaction ran out of the predicate-lock table first, with the other hint: 3,615 tables of one-row point lookups at
max_pred_locks_per_transaction64 (LT03b). A committed transaction kept its predicate locks while another serializable transaction was open (LT03d).
Which do I pick
Section titled “Which do I pick”| Situation | Choice | Why |
|---|---|---|
| A migration touches N tables in one transaction | Compute capacity divided by entries per table, and split or raise before N | The predicted N matched the measured N within 3 tables (LT02) |
The hint names max_locks_per_transaction | Reduce the tables per transaction, or raise it with a restart | Capacity scales 3.75 times for 4 times the setting (LT02-cal) |
The hint names max_pred_locks_per_transaction | Look for SERIALIZABLE transactions touching many tables, or left open | The predicate table filled at 3,615 one-row lookups on its own (LT03b) |
| A restore must run in one transaction | Check the target’s capacity first: the limit sat between 2,350 and 2,400 plain tables at the 17.6, max_connections 90 default | Both psql -1 and pg_restore -1 failed within the same 50-table bracket (LT02d) |
A schema-only pg_dump of many tables | Expect it to pass far above the restore’s limit | It failed only at 11,850 to 11,900 tables, about 1 entry per table (LT02e) |
You hold the postgres role on a managed project | Plan for the platform’s configuration path, not ALTER SYSTEM | ALTER SYSTEM, ALTER ROLE and SET all failed for that role on the images (LT01); the path itself was not run (LT04) |
The same flow as text:
- Read the
HINTof the53200error. It names the table that ran out. - If it names
max_locks_per_transaction, multiply the tables the transaction touched by the entries per table of the operation and compare with the server’s capacity. - If it names
max_pred_locks_per_transaction, look for SERIALIZABLE transactions that read many tables or stay open while others commit. - Split the transaction, or raise the setting and restart.
The hint text differs by major version: HINT: You might need to increase "max_locks_per_transaction". on every 17.x server, and HINT: You might need to increase max_locks_per_transaction. with no quotes on 15.14 (LT02). A matcher on the message needs both forms.
What the images ship
Section titled “What the images ship”LT01 read pg_settings on each image with no settings passed.
| Setting | supabase 17.6 | supabase 17.11 | supabase 15.14 | stock 17.11 |
|---|---|---|---|---|
max_locks_per_transaction (source, context) | 64 (default, postmaster) | 64 (default, postmaster) | 64 (default, postmaster) | 64 (default, postmaster) |
max_connections (source) | 100 (default) | 100 (default) | 100 (default) | 100 (configuration file) |
max_prepared_transactions | 0 | 0 | 0 | 0 |
max_pred_locks_per_transaction (context) | 64 (postmaster) | 64 (postmaster) | 64 (postmaster) | 64 (postmaster) |
max_pred_locks_per_relation / max_pred_locks_per_page (context) | -2 / 2 (sighup) | -2 / 2 (sighup) | -2 / 2 (sighup) | -2 / 2 (sighup) |
shared_memory_size | 174MB | 174MB | 174MB | 143MB |
The supabase images’ /etc/postgresql/postgresql.conf has the four settings commented out and nothing under /etc/postgresql-custom sets them, so the values are the compiled-in defaults. The hosted max_connections differs by compute size (90, 160, 240, 380 and 480 for Small, Large, XL (extra large), 2XL and 4XL in other modules of this lab); the image’s own value is 100.
ALTER SYSTEM SET max_locks_per_transaction = 128as the superuser the rig uses succeeded on all four images. Afterpg_reload_conf()the value still read 64,pending_restartread true andpg_file_settingsshowedappliedfalse with “setting could not be applied”. After adocker restart(3.2 to 3.4 s on this host, not a hosted figure) it read 128, andshared_memory_sizeread 177MB on supabase 17.6, 176MB on 15.14 and 146MB on stock: 2 to 3 MB more than at 64.- As the non-superuser
postgresrole on the three supabase images (rolsuperfalse):ALTER SYSTEM SET max_locks_per_transaction = 128failed42501: permission denied to set parameter "max_locks_per_transaction";ALTER ROLE postgres SET ...andSET ...both failed55P02: parameter "max_locks_per_transaction" cannot be changed without restarting the server. On a hosted project this role is the one a customer has; the platform path was not exercised. - Documented, not tested: the Supabase custom Postgres configuration page lists
max_locks_per_transactionas CLI (command-line interface) only with Restart “Yes” and the example--config max_locks_per_transaction=128, and does not listmax_pred_locks_per_transactionormax_prepared_transactions(read 2026-12-03).1 The live OpenAPI spec carriesmax_locks_per_transaction(integer, minimum 10) andrestart_databasein the update body of/v1/projects/{ref}/config/database/postgres, and no field for the predicate setting (read 2026-12-03).2
Capacity
Section titled “Capacity”Capacity is the number of advisory locks, one lock-table entry each, that a single transaction takes before 53200. One run per configuration, with only the listed settings changed (supabase images unless named). “Docs formula” is max_locks_per_transaction * (max_connections + max_prepared_transactions), the form the PostgreSQL 15 page prints; the 17 page says the table has space for max_locks_per_transaction objects per server process or prepared transaction and no longer prints the product.3
| Config | Server | max_connections | max_locks_per_transaction | max_prepared_transactions | Docs formula | Measured capacity | shared_memory_size |
|---|---|---|---|---|---|---|---|
sb17-mc90-l64 | 17.6 | 90 | 64 | 0 | 5,760 | 12,016 | 173MB |
sb17-mc90-l256 | 17.6 | 90 | 256 | 0 | 23,040 | 44,992 | 181MB |
sb17-mc160-l64 | 17.6 | 160 | 64 | 0 | 10,240 | 19,413 | 177MB |
sb17-mc160-l256 | 17.6 | 160 | 256 | 0 | 40,960 | 73,392 | 190MB |
sb17-mc90-l10 | 17.6 | 90 | 10 | 0 | 900 | 2,813 | 171MB |
sb17-mc100-l64 (image default) | 17.6 | 100 | 64 | 0 | 6,400 | 12,870 | 174MB |
sb17-mc240-l64 | 17.6 | 240 | 64 | 0 | 15,360 | 28,336 | 181MB |
sb17-mc380-l64 | 17.6 | 380 | 64 | 0 | 24,320 | 42,128 | 187MB |
sb17-mc480-l64 | 17.6 | 480 | 64 | 0 | 30,720 | 51,904 | 191MB |
sb17-mc90-l64-pt50 | 17.6 | 90 | 64 | 50 | 8,960 | 17,504 | 176MB |
sb17b-mc90-l64 | 17.11 | 90 | 64 | 0 | 5,760 | 12,016 | 173MB |
sb15-mc90-l64 | 15.14 | 90 | 64 | 0 | 5,760 | 11,888 | 173MB |
stock17-mc90-l64 | 17.11 | 90 | 64 | 0 | 5,760 | 12,064 | 143MB |
- The measured capacity is 1.69 to 2.09 times the documented form at
max_locks_per_transaction64 to 256 (12,016 / 5,760 = 2.09 atsb17-mc90-l64) and 3.13 times at 10. It rises withmax_connectionsat about the same ratio and withmax_prepared_transactions(17,504 at 50 against 12,016 at 0). The documented figure is a floor, not the failure point. - Why the table accepts more than the formula was not tested. A recalled explanation (the
PROCLOCKtable is sized for twice theLOCKtable, and a single backend uses onePROCLOCKperLOCK, leaving the rest to theLOCKtable) fits a ratio of about 1.5 and is unverified; it was not read from the source. - Raising
max_locks_per_transactionby 4 raised capacity 3.74 times atmax_connections90 (44,992 / 12,016) and 3.78 times at 160 (73,392 / 19,413), andshared_memory_sizeby 8 MB and 13 MB.
Entries per operation
Section titled “Entries per operation”“N tables” is N plain tables: create table (id bigint generated always as identity primary key, a text, b int), which is five relations (the table, its primary-key index, the identity sequence, its TOAST table and the TOAST index). Entries per table were measured on one and two blocks of 50 tables, counting distinct lock targets held just before the rollback. “Predicted” is capacity divided by that count, derived, not probed. Primary configuration sb17-mc90-l64, capacity 12,016:
| Operation | Entries per table | Highest N that passed | Lowest N that failed | Predicted N |
|---|---|---|---|---|
(a) CREATE TABLE with an identity primary key, plain statements in one transaction | 5 | 2,401 | 2,402 | 2,403 |
(b) DROP SCHEMA ... CASCADE over N tables, one statement | 8.02 | 1,497 | 1,498 | 1,498 |
(c1) ALTER TABLE ... OWNER TO, N statements in one transaction | 5 | 2,401 | 2,402 | 2,403 |
(c2) REASSIGN OWNED BY the roles owning N tables | 5 | 2,401 | 2,402 | 2,403 |
(d) pg_dump --schema-only then psql --single-transaction | - | 2,350 | 2,400 (bracket of 50) | - |
(d) the same, pg_restore --single-transaction | - | 2,350 | 2,400 (bracket of 50) | - |
(e) pg_dump of N tables | - | 11,850 | 11,900 (bracket of 50) | 12,016 (1 entry per table) |
- On
sb17the five relations were the only entries perCREATE. (a) counted inside a PL/pgSQL (procedural language) block with an exception handler at 2,401 tables, and the plain-statement edge was also 2,401 and 2,402. For (c1) the PL/pgSQL count was 2,400 and the plain-statement edge 2,401 and 2,402 (a lock or two more in the function call). - The predicted N matched the measured one within 3 tables for (a), (b), (c1) and (c2) on every configuration that reached a failure, except (a) on the 15.14 image: 2,368 predicted, 2,376 measured (5.02 entries per table).
- (e):
pg_dumptookACCESS SHAREon every table in one transaction and failed at 11,850 to 11,900 tables, close to the capacity of 12,016. One entry per table is inferred from that match, not counted. The last failing probe was a catalog query, not aLOCK TABLE: on stock 17.11pg_dumpfailed onSELECT s.tableoid, s.oid, s.subname, ... FROM pg_subscription s. - The restore with both tools failed within the same 50-table bracket, 2,350 to 2,400, about the failure point of (a). Capacity divided by the bracket gives about 5 entries per table (derived: 12,016 / 2,375 = 5.06).
psqlstopped on its error (ON_ERROR_STOP) andpg_restorestopped on its error.
The failure text, from the artifact (sb17, primary configuration):
psql:/dumps/lt.sql:83767: ERROR: out of shared memoryHINT: You might need to increase "max_locks_per_transaction".pg_restore: error: could not execute query: ERROR: out of shared memoryHINT: You might need to increase "max_locks_per_transaction".Command was: ALTER TABLE ONLY b0047.t_22 ADD CONSTRAINT t_22_pkey PRIMARY KEY (id);The matrix
Section titled “The matrix”Highest N that passed or lowest N that failed, plain tables: (a) to (c2) exact to one table, (d) and (e) to a bracket of 50. The cap on a search was 14,000 tables, and a cell that reached it reads “none up to 14,000”.
| Config | Capacity | (a) create | (b) DROP SCHEMA | (c1) owner loop | (c2) REASSIGN OWNED | (d) psql -1 | (d) pg_restore -1 | (e) pg_dump |
|---|---|---|---|---|---|---|---|---|
sb17-mc90-l64 | 12,016 | 2,401 | 1,497 | 2,401 | 2,401 | 2,350 / 2,400 | 2,350 / 2,400 | 11,850 / 11,900 |
sb17-mc90-l256 | 44,992 | 8,996 | 5,609 | 8,996 | 8,996 | 8,900 / 8,950 | 8,900 / 8,950 | none up to 14,000 |
sb17-mc160-l64 | 19,413 | 3,880 | 2,420 | 3,881 | 3,880 | 3,850 / 3,900 | 3,850 / 3,900 | none up to 14,000 |
sb17-mc160-l256 | 73,392 | 14,676 | 9,149 | none up to 14,000 | none up to 14,000 | none up to 14,000 | none up to 14,000 | none up to 14,000 |
sb15-mc90-l64 | 11,888 | 2,376 | 1,481 | 2,376 | 2,375 | 2,350 / 2,400 | 2,350 / 2,400 | 11,750 / 11,800 |
stock17-mc90-l64 | 12,064 | 1,722 | 1,503 | 2,411 | 2,410 | 1,700 / 1,750 | 1,700 / 1,750 | 11,900 / 11,950 |
sb17-mc90-l10 | 2,813 | 561 | 350 | 561 | 560 | 550 / 600 | 550 / 600 | 2,650 / 2,700 |
The cells that hit the 14,000-table cap are past their predicted failure points (about 14,700 and above) and read “not reached”, not “fails after”.
- Four times
max_locks_per_transactiontook every failure point from 2,401 to 8,996 (3.75 times);max_connections90 to 160 took it from 2,401 to 3,880 (1.62 times). stock17(17.11) andsb17b(17.11) create 1,722 and 1,715 tables wheresb17(17.6) creates 2,401 andsb15(15.14) 2,376: 7 entries perCREATE TABLEagainst 5. The breakdown after 100 tables, by kind of distinct lock target: 17.6 and 15.14 hold relation entries only (101 tables, 202 indexes, 100 sequences, 100 TOAST tables, plus one schema object); 17.11, supabase and stock, hold the same relations plus 100pg_constraintand 100pg_typeobject entries. So the minor, not the supabase build, sets the 7. Why 17.11 locks those two objects was not investigated.DROP SCHEMA(8.02 entries per table) and the ownership operations (5) were the same on all four images.
Table shape
Section titled “Table shape”A table with the identity primary key plus a foreign key to a parent, a UNIQUE constraint, a second index, a CHECK, a row-level security policy and a row trigger took 19.02 entries on DROP SCHEMA ... CASCADE (plain: 8.02) and 7 on ALTER TABLE ... OWNER TO (plain: 5). At capacity 12,016 that is 631 tables of the rich shape for a DROP SCHEMA (derived: 12,016 / 19.02, not probed) against 1,497 plain ones (probed). The same ratio holds on every configuration. A table with more indexes, policies, triggers and dependent objects than this shape lowers the figure further, and so do objects in the same transaction that are not tables. The CLI’s reset command was not run and no real schema was dropped.
SERIALIZABLE and the predicate-lock table
Section titled “SERIALIZABLE and the predicate-lock table”Settings: max_connections 90, max_locks_per_transaction 64, supabase 17.6 with max_pred_locks_per_transaction 64, 32, 16 and 10, and stock 17.11 at 64; max_pred_locks_per_relation -2 and max_pred_locks_per_page 2 (defaults). A fixture of small tables st.t_N (a primary key and 100 rows each; 130 per unit of max_pred_locks_per_transaction, so 8,320 tables at 64) was ANALYZEd and the plan of each pattern pinned with enable_* settings. Every error below is 53200 out of shared memory; the hint names the table that ran out: “pred” is max_pred_locks_per_transaction, “lock” is max_locks_per_transaction.
Promotion (LT03a). One SERIALIZABLE transaction reads k rows of a 600-page table with one row per page. rel/page/tuple/total are SIReadLock rows by granularity.
| Config | k at which the 600-page table went to a relation lock | Held after k = 5, 8, 9, 16, 17, 31, 33, 64, 400 |
|---|---|---|
| p64 | between 31 (no) and 33 (yes) | 0/1/5/6, 0/1/8/9, 0/1/9/10, 0/1/16/17, 0/1/17/18, 0/1/31/32, 1/1/0/2, 1/1/0/2, 1/2/0/3 |
| p32 | between 9 (no) and 16 (yes) | 0/1/5/6, 0/1/8/9, 0/1/9/10, 1/1/0/2, then 1/1/0/2 and on, 1/2/0/3 |
| p16 | between 5 (no) and 8 (yes) | 0/1/5/6, 1/1/0/2, then 1/1/0/2 and on, 1/2/0/3 |
| p10 | at or below 5 | 1/1/0/2 from k = 5 on, 1/2/0/3 at 400 |
Reading 1,000 and 20,000 scattered rows of a 100,000-row narrow table left 2/0/0/2 held on every config. Reading many rows of one table did not exhaust the table: each heap relation drops to one relation lock after about max_pred_locks_per_transaction / 2 tuple locks (the threshold of the max_pred_locks_per_relation default of -2; between the tested k values on three configs, at k = 5 on p10). The documented sentence “not the number of rows that can be locked” holds here.
One session, many tables (LT03b). Tables read in one transaction before the first error, and SIReadLock rows held when it came (counted after the error; the rows of the aborted sub-block are kept):
| Config | Point lookup, 1 row of each table | SIReadLock rows held at the error | 50-row range | Sequential scan of each table |
|---|---|---|---|---|
| p64 | 3,615 (pred) | 7,231 | 3,614 (pred) | 5,870 (lock) |
| p32 | 1,807 (pred) | 3,615 | 1,806 (pred) | 3,615 (pred) |
| p16 | 903 (pred) | 1,807 | 902 (pred) | 1,807 (pred) |
| p10 | 564 (pred) | 1,129 | 563 (pred) | 1,129 (pred) |
| stock p64 | 3,615 (pred) | 7,231 | 3,614 (pred) | 5,846 (lock) |
- A point lookup held 2 rows per table (the heap tuple and an index page) and a sequential scan 1 (the relation). At the error the rows held were 7,231, 3,615, 1,807 and 1,129 for 64, 32, 16 and 10:
max_pred_locks_per_transaction * 113 - 1on all four. That is a fit over four values, not read from the source. - At 64 the sequential scans stopped on the lock table, hint
max_locks_per_transaction, at 5,870 tables on supabase and 5,846 on stock, about half the lock-table capacity of 12,016. Two entries per table (the table and its index) would give 11,740; that is inferred from the arithmetic, not counted, and the lock-table limit was not tested without SERIALIZABLE. So at the defaults a transaction that reads about 6,000 tables hits the lock table whether or not it is SERIALIZABLE.
Concurrent sessions (LT03c). S sessions each hold a SERIALIZABLE transaction and read one table per step round robin until the first error. Total reads before it:
| Config | Disjoint tables, S = 1, 4, 16, 48 | Shared tables, S = 1, 4, 16, 48 |
|---|---|---|
| p64 | 3,615, 3,615, 3,615, 3,615 (pred all four) | 3,615 (pred), 5,916, 6,012, 6,268 (lock) |
| p32 | 1,807 x4 (pred) | 1,807 (pred), 3,616, 3,616, 3,616 (pred) |
| p16 | 903 x4 (pred) | 903 (pred), 1,808, 1,808, 1,808 (pred) |
| p10 | 564 x4 (pred) | 564 (pred), 1,130, 1,130, 1,130 (pred) |
| stock p64 | 3,615 x4 (pred) | 3,615 (pred), 6,044, 6,140, 6,396 (lock) |
With disjoint tables the pool is shared: the total is the single-session figure for every S, so a session’s share is the total over S (3,615 / 48 = 75 tables per session at p64 and 48 sessions). With shared tables the targets are shared and the sessions’ holdings are the limit; at p16 the total reached 1,808, twice one session’s 903 (the doubling is inferred, not read from the source). At 64 the lock table ended it first, at 5,916 to 6,396.
Retention after commit (LT03d). One session holds a SERIALIZABLE transaction open (it read a table; the second variant also inserted a row; neither was declared READ ONLY) while another session runs short SERIALIZABLE transactions that each read one row of its own table, insert a row into a log table and commit:
| Config | Commits before the error, holder that read | Holder that wrote | No holder | SIReadLock rows after (holder / no holder) |
|---|---|---|---|---|
| p64 | 3,615 (pred) | 3,615 (pred) | none up to 8,320 (the fixture) | 7,231 / 0 |
| p32 | 1,807 (pred) | 1,807 (pred) | none up to 4,160 | 3,615 / 0 |
| p16 | 903 (pred) | 903 (pred) | none up to 2,080 | 1,807 / 0 |
| p10 | 564 (pred) | 564 (pred) | none up to 1,300 | 1,129 / 0 |
| stock p64 | 3,615 (pred) | 3,615 (pred) | none up to 8,320 | 7,231 / 0 |
Committed transactions kept their SIReadLock rows while another serializable transaction was open: each retained 2 rows, and the table filled after (max_pred_locks_per_transaction * 113 - 1) / 2 commits, rounded down (3,615 at 64). With no other transaction open the same stream of commits left 0 rows and never failed. A holder declared READ ONLY or DEFERRABLE, which Postgres treats differently, was not run.4
What was not measured
Section titled “What was not measured”- Anything on a hosted project: the default
max_locks_per_transactionper compute size, whethersupabase postgres-config updateorPATCH /v1/projects/{ref}/config/database/postgresaccepts the change for a given plan and role, whether the project restarts by itself or needsrestart_database, the restart’s duration and the downtime a client sees. LT04 is the scaffold; it was not applied. - The platform’s
max_connectionsper size came from other modules of this lab; the table operations ran at 90 and 160, the other sizes only as capacity. - The major-upgrade script itself,
pg_upgradeand the CLI reset command: only their operations were modelled. Objects other than tables (views, functions, types, separately owned sequences, policies on their own), partitioned tables and extensions in the ownership operations. - Parallel
pg_dump -jandpg_restore -j, data dumps,COPY-based restores and restores through a pooler. - PostgreSQL 16, 18 and 19, amd64 images (
shared_memory_sizeand so the slack above the formula may differ),max_pred_locks_per_relationandmax_pred_locks_per_pageat non-default values,max_prepared_transactionsabove 0 in the table operations (only in the calibration), and a standby, where the documents say the value must be the same or higher.3 - Why the lock table accepts 1.69 to 2.09 times the documented capacity, and why 17.11 takes two more entries per
CREATE TABLE. - SERIALIZABLE on partitioned tables, the error a different shared structure raises when it runs out first, a
READ ONLYorDEFERRABLEholder, and a real workload.
Reading the numbers
Section titled “Reading the numbers”- An “entry” is one lock-table target (a relation, or an object such as a type or a constraint) that a backend holds. Capacity is the advisory-lock count at
53200, so it counts entries in the same unit as the operations. - Entries per table were counted as distinct lock targets. A first smoke run counted
pg_locksrows, and a backend holding two modes on one relation has two rows but one entry, soCREATE TABLEread 10 where the capacity supports 5; that run is unpublished and the module was corrected. - A first LT03 run had unanalysed fixture tables and unpinned plans, and stock 17.11 read 5,967 and 6,223 tables where supabase read 3,615 on the disjoint arms. The most likely cause is a sequential scan on tables autovacuum had analysed, with the set varying by run; the plans were not captured in that run, so this is inferred. The three published runs are of the fixed module.
- Rates and timings are not reported; the VM was shared.
- One run per configuration except the primary configuration, which ran three times with identical cells.
What to do about it
Section titled “What to do about it”| Practice | Evidence | Module |
|---|---|---|
| Divide capacity by entries per table before a bulk operation | The predicted N matched the measured N within 3 tables for create, drop and both owner changes | LT02 |
| Treat the documented formula as a floor and measure the real capacity | 12,016 measured against 5,760 documented at max_connections 90 and 64 | LT02-cal |
| Drop a large schema in batches of under capacity / 8.02 tables | DROP SCHEMA ... CASCADE took 8.02 entries per plain table, so 1,497 tables passed at the 17.6 default; a table with a foreign key, UNIQUE, second index, CHECK, policy and trigger took 19.02 | LT02 |
Budget 7 entries per CREATE TABLE on 17.11 and later minors | 1,722 tables on stock 17.11 and 1,715 on supabase 17.11 against 2,401 on 17.6 | LT02 |
| Check the target’s capacity before a restore in one transaction | psql -1 and pg_restore -1 both failed at 2,350 to 2,400 tables at the 17.6, max_connections 90 default | LT02d |
Restore thousands of tables without --single-transaction | A design choice, not run: the limit applies to one transaction’s locks, and the restore tools’ single-transaction mode is what put every table in one | LT02d (the failure, not the alternative) |
Raise max_locks_per_transaction with a restart when splitting is not possible | 64 to 256 took failure points 2,401 to 8,996 and shared_memory_size 173MB to 181MB; context postmaster; value read 64 until the restart | LT02-cal, LT01 |
Use the platform’s configuration path for the setting, not ALTER SYSTEM | The postgres role got 42501 and 55P02; the path is documented as CLI only with a restart and was not run | LT01, LT04 (scaffold, not applied) |
| Read the hint to pick the right table | The SERIALIZABLE arms failed on max_pred_locks_per_transaction at 564 to 3,615 tables; the sequential-scan arm at 64 failed on max_locks_per_transaction | LT03b |
| Close a long SERIALIZABLE transaction rather than keeping it open beside many short ones | Each commit retained 2 SIReadLock rows while one holder was open; 3,615 commits filled the table at p64, 0 rows and no failure with no holder | LT03d |
| Match the setting on a standby to the primary’s or higher | Documented only; no standby was run3 | none (documented) |
Reproducing
Section titled “Reproducing”The experiment is experiments/lock-table in supabase-lab. It needs Docker, the four images (three supabase/postgres images of about 1.3 GB each and postgres:17-alpine) and free space in the Docker VM for the dumps.
make probe # LT01, LT02, LT03; writes evidence/<ts>/make probe ONLY=LT02 LT_CONFIGS=sb17-mc90-l64make probe ONLY=LT03 LT3_CONFIGS=sb17-mc90-p64make facts # measurements of the newest run as markdownResult ids carry the configuration: LT02b-sb17-mc90-l64 is operation (b) on sb17, max_connections 90, max_locks_per_transaction 64.
Evidence
Section titled “Evidence”| Claim | Status | How it was checked |
|---|---|---|
Capacity 12,016 at max_connections 90 and max_locks_per_transaction 64 on 17.6, and the other 12 configurations | measured, one run each; the primary three times | LT02-cal, run A facts, calibration facts |
Failure points of the four operations and pg_dump, seven configurations | measured, one run each; the primary three times | LT02, run A facts, P1 facts, P2 facts |
7 entries per CREATE TABLE on 17.11, by lock-target kind | measured, one run | LT02, lock-kind facts |
| The 17.11 supabase image’s own failure points | measured, one run | LT02, 17.11 facts |
Image settings, ALTER SYSTEM pending until restart, postgres role refused | measured, one run | LT01, facts |
| SERIALIZABLE promotion, tables per session, concurrent sessions, retention | measured, 3 runs, identical | LT03, R1 facts, R2 facts, R3 facts |
| Documented capacity wording, default 64, restart required, standby rule | documented3 | PostgreSQL 15 and 17 pages, doc-read 2026-12-03 and again for this page |
| CLI only, restart “Yes”, example value; spec fields | documented12 | doc-read 2026-12-03 in the lab RUNLOG; not re-read for the field list |
| Hosted default per compute size, Management API acceptance, restart | not measured | LT04 scaffold, not applied |
No docs-versus-runtime disagreement was found, and the measured capacity above the documented formula is not a disagreement the docs claim to settle, so nothing was filed upstream.
Modules
Section titled “Modules”| Module | Experiment | Test | Artifact |
|---|---|---|---|
| LT01 | lock-table | lt01-inventory.ts | run-2026-12-03T06-43-25-715Z |
| LT02 | lock-table | lt02-failure-points.ts | run-2026-12-03T06-15-08-879Z |
| LT03 | lock-table | lt03-serializable.ts | run-2026-12-03T06-25-43-583Z |
| LT04 | lock-table | lt04-hosted.ts | none published (scaffold, not applied) |
Related docs
Section titled “Related docs”- Postgres lock queue behind ACCESS EXCLUSIVE, lock_timeout and PgBouncer - the other lock failure: readers waiting behind a migration, which this page’s capacity limit does not cover.
- Foreign keys to auth.users block sign-in during validation - table-level lock modes of DDL (data definition language) on a hot table.
- The simple least-recently-used (SLRU) caches behind row-level locks, in Postgres MultiXact SLRU contention, beside the table-level entries counted here.
- Supabase compute and disk sizing - the compute sizes whose
max_connectionsfix the capacity arms.
References
Section titled “References”-
Supabase, “Customizing Postgres configs,” Supabase Docs. https://supabase.com/docs/guides/database/custom-postgres-config ↩ ↩2
-
Supabase, “Management API,” OpenAPI specification (
UpdatePostgresConfigBody,PostgresConfigResponse_Output). https://api.supabase.com/api/v1-json ↩ ↩2 -
PostgreSQL Global Development Group, “Lock Management,” PostgreSQL 15 and 17 Documentation,
max_locks_per_transactionandmax_pred_locks_per_transaction. https://www.postgresql.org/docs/17/runtime-config-locks.html ↩ ↩2 ↩3 ↩4 -
PostgreSQL Global Development Group, “Transaction Isolation,” PostgreSQL 17 Documentation. https://www.postgresql.org/docs/17/transaction-iso.html ↩
Linked from
- pgmig, logical-replication migration scope and gates
- Postgres lock queue behind ACCESS EXCLUSIVE, lock_timeout and PgBouncer
- Postgres MultiXact SLRU contention from foreign-key inserts into a hot parent row
- Postgres statistics counters: stats_reset, idx_scan and what resets them
- Supabase compute and disk sizing