Re: Large expressions in indexes can't be stored (non-TOASTable)
Euler Taveira <euler@eulerto.com>
From: "Euler Taveira" <euler@eulerto.com>
To: "Nathan Bossart" <nathandbossart@gmail.com>,
"Amit Kapila" <amit.kapila16@gmail.com>
Cc: "Michael Paquier" <michael@paquier.xyz>,
"Alexander Lakhin" <exclusion@gmail.com>, "Tom Lane" <tgl@sss.pgh.pa.us>,
"Jonathan S. Katz" <jkatz@postgresql.org>,
"PostgreSQL Hackers" <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-09T02:21:31Z
Lists: pgsql-hackers
On Tue, Apr 8, 2025, at 5:25 PM, Nathan Bossart wrote: > On Tue, Apr 08, 2025 at 04:44:02PM +0530, Amit Kapila wrote: > > On Fri, Apr 4, 2025 at 7:58 PM Nathan Bossart <nathandbossart@gmail.com> wrote: > >> On Fri, Apr 04, 2025 at 05:16:43PM +0530, Amit Kapila wrote: > >> > Can we dodge adding this push call if we restrict the length of the > >> > origin name to some reasonable limit like 256 or 512 and avoid the > >> > need of toast altogether? > >> > >> We did consider just removing pg_replication_origin's TOAST table earlier > >> [0], but we decided against it at that time. Maybe it's worth > >> reconsidering... > > > > I don't see any good reason in that email for not removing the TOAST > > table for pg_replication_origin. I would prefer to remove it rather > > than add protection related to its access. > > The only reason I can think of is that folks might have existing > replication origins with extremely long names that would cause upgrades to > fail. While I think it would be probably be okay to remove the TOAST table > and restrict origin names to 512 bytes (like we did for password hashes in > commit 8275325), folks routinely complain about NAMEDATALEN, so I think we > should be cautious here. The logical replication creates origin names as pg_SUBOID_RELID or pg_SUBOID. It means the maximum origin name is 24. This limited origin name also applies to pglogical that limits the name to 54 IIRC. I think that covers the majority of the logical replication setups. There might be a small number of custom logical replication systems that possibly use long names for replication origin. I've never seen a replication origin name longer than NAMEDATALEN. If you consider that the maximum number of replication origin is limited to 2 bytes (65k distinct names), it is reasonable to restrict the replication origin names to 512 due to the high number of combinations. We generally expects that a catalog string uses "name" as type if it is an identifier; it could be the case for roname if author decided to be strict. This additional TOAST table has no or rare use. +1 for removing it. It is one less file, one less table and one less index; in short, one less source of data corruption. ;) -- Euler Taveira EDB https://www.enterprisedb.com/
Commits
-
Ensure we have a snapshot when updating various system catalogs.
- fe8ea7a2a893 17.6 landed
- ddfcfb7cec68 15.14 landed
- b7ba2c0308ce 13.22 landed
- b65be6ef00e2 14.19 landed
- 706054b11b95 18.0 landed
- 24135398f1e1 16.10 landed
-
Remove pg_replication_origin's TOAST table.
- 16bf24e0e471 18.0 landed
-
Restrict password hash length.
- 8275325a06ed 18.0 cited
-
Ensure we have a snapshot when updating pg_index entries.
- b52adbad4674 18.0 landed
-
Add TOAST table to pg_index.
- b52c4fc3c09e 18.0 landed
-
Add toast tables to most system catalogs
- 96cdeae07f93 12.0 cited