pgsql: Move attribute statistics functions to stat_utils.c

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Move attribute statistics functions to stat_utils.c
Date: 2025-12-25 06:17:02
Message-ID: E1vYeej-002ZaE-2z@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Move attribute statistics functions to stat_utils.c

Many of the operations done for attribute stats in attribute_stats.c
share the same logic as extended stats, as done by a patch under
discussion to add support for extended stats import and export. All the
pieces necessary for extended statistics are moved to stats_utils.c,
which is the file where common facilities are shared for stats files.

The following renames are done:
* get_attr_stat_type() -> statatt_get_type()
* init_empty_stats_tuple() -> statatt_init_empty_tuple()
* set_stats_slot() -> statatt_set_slot()
* get_elem_stat_type() -> statatt_get_elem_type()

While on it, this commit adds more documentation for all these
functions, describing more their internals and the dependencies that
have been implied for attribute statistics. The same concepts apply to
extended statistics, at some degree.

Author: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Yu Wang <wangyu_runtime(at)163(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/213a1b89527049cb27bbcd6871fdb0c0916b43e1

Modified Files
--------------
src/backend/statistics/attribute_stats.c | 464 ++++---------------------------
src/backend/statistics/stat_utils.c | 378 +++++++++++++++++++++++++
src/include/statistics/stat_utils.h | 18 ++
3 files changed, 456 insertions(+), 404 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-12-25 17:05:19 Re: pgsql: Track LLVM 15 changes.
Previous Message Richard Guo 2025-12-25 03:16:11 pgsql: Fix planner error with SRFs and grouping sets