pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Save a few bytes in pg_attribute
Date: Tue, 28 Mar 2023 08:18:00 +0000
Message-ID: <E1ph4Wl-0007XL-2y@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1ph4Wl-0007XL-2y@gemulon.postgresql.org>
Permalink:  ../E1ph4Wl-0007XL-2y@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ph4Wl-0007XL-2y@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Save a few bytes in pg_attribute
  In-Reply-To: <E1ph4Wl-0007XL-2y@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox