From 400f44d18875c40605147c8d81793c6dcc46f8a6 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 20 Mar 2023 09:51:20 +0100 Subject: [PATCH] Save a few bytes in pg_attribute attstattarget and attinhcount can be converted to int16 (from int32). --- doc/src/sgml/catalogs.sgml | 36 +++++++++++++++--------------- src/backend/catalog/heap.c | 4 ++-- src/backend/catalog/index.c | 2 +- src/include/catalog/pg_attribute.h | 20 ++++++++--------- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 746baf5053..ad5d15ec49 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1164,23 +1164,6 @@ <structname>pg_attribute</structname> Columns - - - attstattarget int4 - - - attstattarget controls the level of detail - of statistics accumulated for this column by - ANALYZE. - A zero value indicates that no statistics should be collected. - A negative value says to use the system default statistics target. - The exact meaning of positive values is data type-dependent. - For scalar data types, attstattarget - is both the target number of most common values - to collect, and the target number of histogram bins to create. - - - attlen int2 @@ -1362,7 +1345,7 @@ <structname>pg_attribute</structname> Columns - attinhcount int4 + attinhcount int2 The number of direct ancestors this column has. A column with a @@ -1370,6 +1353,23 @@ <structname>pg_attribute</structname> Columns + + + attstattarget int2 + + + attstattarget controls the level of detail + of statistics accumulated for this column by + ANALYZE. + A zero value indicates that no statistics should be collected. + A negative value says to use the system default statistics target. + The exact meaning of positive values is data type-dependent. + For scalar data types, attstattarget + is both the target number of most common values + to collect, and the target number of histogram bins to create. + + + attcollation oid diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 4f006820b8..c67dfffa56 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -732,7 +732,6 @@ InsertPgAttributeTuples(Relation pg_attribute_rel, slot[slotCount]->tts_values[Anum_pg_attribute_attname - 1] = NameGetDatum(&attrs->attname); slot[slotCount]->tts_values[Anum_pg_attribute_atttypid - 1] = ObjectIdGetDatum(attrs->atttypid); - slot[slotCount]->tts_values[Anum_pg_attribute_attstattarget - 1] = Int32GetDatum(attrs->attstattarget); slot[slotCount]->tts_values[Anum_pg_attribute_attlen - 1] = Int16GetDatum(attrs->attlen); slot[slotCount]->tts_values[Anum_pg_attribute_attnum - 1] = Int16GetDatum(attrs->attnum); slot[slotCount]->tts_values[Anum_pg_attribute_attndims - 1] = Int32GetDatum(attrs->attndims); @@ -749,7 +748,8 @@ InsertPgAttributeTuples(Relation pg_attribute_rel, slot[slotCount]->tts_values[Anum_pg_attribute_attgenerated - 1] = CharGetDatum(attrs->attgenerated); slot[slotCount]->tts_values[Anum_pg_attribute_attisdropped - 1] = BoolGetDatum(attrs->attisdropped); slot[slotCount]->tts_values[Anum_pg_attribute_attislocal - 1] = BoolGetDatum(attrs->attislocal); - slot[slotCount]->tts_values[Anum_pg_attribute_attinhcount - 1] = Int32GetDatum(attrs->attinhcount); + slot[slotCount]->tts_values[Anum_pg_attribute_attinhcount - 1] = Int16GetDatum(attrs->attinhcount); + slot[slotCount]->tts_values[Anum_pg_attribute_attstattarget - 1] = Int16GetDatum(attrs->attstattarget); slot[slotCount]->tts_values[Anum_pg_attribute_attcollation - 1] = ObjectIdGetDatum(attrs->attcollation); if (attoptions && attoptions[natts] != (Datum) 0) slot[slotCount]->tts_values[Anum_pg_attribute_attoptions - 1] = attoptions[natts]; diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 7777e7ec77..bccea1c749 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -1812,7 +1812,7 @@ index_concurrently_swap(Oid newIndexId, Oid oldIndexId, const char *oldName) memset(repl_repl, false, sizeof(repl_repl)); repl_repl[Anum_pg_attribute_attstattarget - 1] = true; - repl_val[Anum_pg_attribute_attstattarget - 1] = Int32GetDatum(attstattarget); + repl_val[Anum_pg_attribute_attstattarget - 1] = Int16GetDatum(attstattarget); newTuple = heap_modify_tuple(attrTuple, RelationGetDescr(pg_attribute), diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index b561e17781..a0d6409036 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -52,15 +52,6 @@ CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75, */ Oid atttypid BKI_LOOKUP_OPT(pg_type); - /* - * attstattarget is the target number of statistics datapoints to collect - * during VACUUM ANALYZE of this column. A zero here indicates that we do - * not wish to collect any stats about this column. A "-1" here indicates - * that no value has been explicitly set for this column, so ANALYZE - * should use the default setting. - */ - int32 attstattarget BKI_DEFAULT(-1); - /* * attlen is a copy of the typlen field from pg_type for this attribute. * See atttypid comments above. @@ -165,7 +156,16 @@ CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(75, bool attislocal BKI_DEFAULT(t); /* Number of times inherited from direct parent relation(s) */ - int32 attinhcount BKI_DEFAULT(0); + int16 attinhcount BKI_DEFAULT(0); + + /* + * attstattarget is the target number of statistics datapoints to collect + * during VACUUM ANALYZE of this column. A zero here indicates that we do + * not wish to collect any stats about this column. A "-1" here indicates + * that no value has been explicitly set for this column, so ANALYZE + * should use the default setting. + */ + int16 attstattarget BKI_DEFAULT(-1); /* attribute's collation, if any */ Oid attcollation BKI_LOOKUP_OPT(pg_collation); base-commit: 0b51d423e974557e821d890c0a3a49e419a19caa -- 2.39.2