Thread: pgsql: Create functions pg_set_relation_stats, pg_clear_relation_stats.

pgsql: Create functions pg_set_relation_stats, pg_clear_relation_stats.

From
Jeff Davis
Date:
Create functions pg_set_relation_stats, pg_clear_relation_stats.

These functions are used to tweak statistics on any relation, provided
that the user has MAINTAIN privilege on the relation, or is the database
owner.

Bump catalog version.

Author: Corey Huinker
Discussion: https://postgr.es/m/CADkLM=eErgzn7ECDpwFcptJKOk9SxZEk5Pot4d94eVTZsvj3gw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e839c8ecc9352b7754e74f19ace013c0c0d18613

Modified Files
--------------
doc/src/sgml/func.sgml                     |  94 +++++++++++++
src/backend/catalog/system_functions.sql   |  10 ++
src/backend/statistics/Makefile            |   4 +-
src/backend/statistics/meson.build         |   2 +
src/backend/statistics/relation_stats.c    | 210 +++++++++++++++++++++++++++++
src/backend/statistics/stat_utils.c        |  94 +++++++++++++
src/include/catalog/catversion.h           |   2 +-
src/include/catalog/pg_proc.dat            |  15 +++
src/include/statistics/stat_utils.h        |  29 ++++
src/test/regress/expected/stats_import.out | 143 ++++++++++++++++++++
src/test/regress/parallel_schedule         |   2 +-
src/test/regress/sql/stats_import.sql      |  98 ++++++++++++++
12 files changed, 700 insertions(+), 3 deletions(-)


Re: pgsql: Create functions pg_set_relation_stats, pg_clear_relation_stats.

From
Alexander Korotkov
Date:
On Sun, Oct 13, 2024 at 6:21 PM Jeff Davis <jdavis@postgresql.org> wrote:
> Create functions pg_set_relation_stats, pg_clear_relation_stats.
>
> These functions are used to tweak statistics on any relation, provided
> that the user has MAINTAIN privilege on the relation, or is the database
> owner.

+#include "utils/array.h"
+#include "utils/builtins.h"
+#include "utils/acl.h"
+#include "utils/rel.h"

Please, check the alphabetical order of includes in stat_utils.c.

------
Regards,
Alexander Korotkov
Supabase



Re: pgsql: Create functions pg_set_relation_stats, pg_clear_relation_stats.

From
Jeff Davis
Date:
On Tue, 2024-10-15 at 02:00 +0300, Alexander Korotkov wrote:
> Please, check the alphabetical order of includes in stat_utils.c.

Thank you, fixed. Did you use a tool or just happen to notice?

Regards,
    Jeff Davis