pgsql: Save a few bytes in pg_attribute

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Save a few bytes in pg_attribute
Date: 2023-03-28 08:18:00
Message-ID: E1ph4Wl-0007XL-2y@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Save a few bytes in pg_attribute

Change the columns attndims, attstattarget, and attinhcount from int32
to int16, and reorder a bit. This saves some space (currently 4
bytes) in pg_attribute and tuple descriptors, which translates into
small performance benefits and/or room for new columns in pg_attribute
needed by future features.

attndims and attinhcount are never realistically used with values
larger than int16. Just to be sure, add some overflow checks.
attstattarget is currently limited explicitly to 10000.

For consistency, pg_constraint.coninhcount is also changed like
attinhcount.

Discussion: https://www.postgresql.org/message-id/flat/d07ffc2b-e0e8-77f7-38fb-be921dff71af%40enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/90189eefc1e11822794e3386d9bafafd3ba3a6e8

Modified Files
--------------
doc/src/sgml/catalogs.sgml | 60 ++++++++++++++++++-------------------
src/backend/access/common/tupdesc.c | 8 +++++
src/backend/catalog/heap.c | 11 +++++--
src/backend/catalog/index.c | 2 +-
src/backend/catalog/pg_constraint.c | 6 +++-
src/backend/commands/tablecmds.c | 28 +++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_attribute.h | 34 +++++++++++----------
src/include/catalog/pg_constraint.h | 2 +-
9 files changed, 100 insertions(+), 53 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2023-03-28 15:25:11 pgsql: initdb: replace check_icu_locale() with default_icu_locale().
Previous Message Peter Geoghegan 2023-03-27 23:17:02 pgsql: pg_walinspect: Adjust memory context name.