public inbox for [email protected]
help / color / mirror / Atom feedRe: PG 16 draft release notes ready
3+ messages / 3 participants
[nested] [flat]
* Re: PG 16 draft release notes ready
@ 2023-05-19 01:44 Bruce Momjian <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Momjian @ 2023-05-19 01:44 UTC (permalink / raw)
To: Peter Geoghegan <[email protected]>; +Cc: pgsql-hackers
On Thu, May 18, 2023 at 04:12:26PM -0700, Peter Geoghegan wrote:
> On Thu, May 18, 2023 at 3:52 PM Bruce Momjian <[email protected]> wrote:
> > So, I looked at this and the problem is that this is best as a single
> > release note entry because we are removing and adding, and if I moved it
> > to compatibility, I am concerned the new feature will be missed. Since
> > WAL inspection is a utility operation, inn general, I think having it in
> > the pg_walinspect section makes the most sense.
>
> I don't understand what you mean by that. The changes to
> *_till_end_of_wal() (the way that those duplicative functions were
> removed, and more permissive end_lsn behavior was added) is unrelated
> to all of the other changes. Plus it's just not very important.
I see what you mean now. I have moved the function removal to the
incompatibilities section and kept the existing entry but remove the
text about the removed functions.
> > Okay, I went with:
> >
> > Improve descriptions of pg_walinspect WAL record descriptions
> > (Melanie Plageman, Peter Geoghegan)
> >
> > > Note also that the item "Add pg_waldump option --save-fullpage to dump
> > > full page images (David Christensen)" is tangentially related to
> > > pg_get_wal_block_info(), since you can also get FPIs using
> > > pg_get_wal_block_info() (in fact, that was originally its main
> > > purpose). I'm not saying that you necessarily need to connect them
> > > together in any way, but you might consider it.
> >
> > Well, there is so much _new_ in that tool that listing everything new
> > seems confusing.
>
> There is pretty much one truly new piece of functionality added to
> pg_walinspect (the function called pg_get_wal_block_info was added) --
> since the enhancement to rmgr description output applies equally to
> pg_waldump, no matter where you place it in the release notes. So not
> sure what you mean.
I see what you mean now. I have removed the mention of
pg_get_wal_block_info() and moved the three items back into the
extension section since there are only three pg_walinspect items now.
> > All changes committed.
>
> Even after these changes, the release notes still refer to a function
> called "pg_get_wal_block". There is no such function, though -- not in
> Postgres 16, and not in any other major version.
Oh
>
> As I said, there is a new function called "pg_get_wal_block_info". It
> should simply be presented as a whole new function that offers novel
> new functionality compared to what was available in Postgres 15 --
> without any further elaboration. (It happens to be true that
> pg_get_wal_block_info only reached its final form following multiple
> rounds of work in multiple commits, but that is of no consequence to
> users -- even the earliest form of the function appeared in a commit
> in the Postgres 16 cycle.)
Done. Please see the URL for the updated text, diff attached.
--
Bruce Momjian <[email protected]> https://momjian.us
EDB https://enterprisedb.com
Only you can decide what is important to you.
Attachments:
[text/x-diff] master.diff (5.0K, ../../[email protected]/2-master.diff)
download | inline diff:
diff --git a/doc/src/sgml/release-16.sgml b/doc/src/sgml/release-16.sgml
index 47f6cae907..5c17237966 100644
--- a/doc/src/sgml/release-16.sgml
+++ b/doc/src/sgml/release-16.sgml
@@ -91,6 +91,17 @@ Processing such indexes is still possible using REINDEX SYSTEM.
</para>
</listitem>
+<!--
+Author: Michael Paquier <[email protected]>
+2023-03-14 [5c1b66280] Rework design of functions in pg_walinspect
+-->
+
+<listitem>
+<para>
+Remove pg_walinspect functions pg_get_wal_records_info_till_end_of_wal() and pg_get_wal_stats_till_end_of_wal().
+</para>
+</listitem>
+
<!--
Author: Michael Paquier <[email protected]>
2023-03-17 [98ae2c84a] libpq: Remove code for SCM credential authentication
@@ -2848,6 +2859,55 @@ Previously constants appeared instead of placeholders, e.g., $1.
</para>
</listitem>
+<!--
+Author: Michael Paquier <[email protected]>
+2023-01-23 [c31cf1c03] pg_walinspect: Add pg_get_wal_fpi_info()
+Author: Michael Paquier <[email protected]>
+2023-03-10 [9ecb134a9] pg_walinspect: pg_get_wal_fpi_info() -> pg_get_wal_block
+Author: Peter Geoghegan <[email protected]>
+2023-03-30 [122376f02] Show record information in pg_get_wal_block_info.
+Author: Peter Geoghegan <[email protected]>
+2023-03-31 [df4f3ab51] Add show_data option to pg_get_wal_block_info.
+-->
+
+<listitem>
+<para>
+Add pg_walinspect function pg_get_wal_block_info() to report WAL block information (Michael Paquier, Melanie Plageman, Bharath Rupireddy)
+</para>
+</listitem>
+
+<!--
+Author: Michael Paquier <[email protected]>
+2023-03-14 [5c1b66280] Rework design of functions in pg_walinspect
+-->
+
+<listitem>
+<para>
+Change how pg_walinspect functions pg_get_wal_records_info(), pg_get_wal_stats(), and pg_get_wal_block_info() interpret ending LSNs (Bharath Rupireddy)
+</para>
+
+<para>
+Previously ending LSNs which represent nonexistent WAL locations would generate an error, while they will now be interpreted as the end of the WAL.
+</para>
+</listitem>
+
+<!--
+Author: Peter Geoghegan <[email protected]>
+2023-04-07 [7d8219a44] Show more detail in heapam rmgr descriptions.
+Author: Peter Geoghegan <[email protected]>
+2023-04-07 [1c453cfd8] Show more detail in nbtree rmgr descriptions.
+Author: Peter Geoghegan <[email protected]>
+2023-04-11 [96149a180] Fix Heap rmgr's desc output for infobits arrays.
+Author: Peter Geoghegan <[email protected]>
+2023-04-19 [50547a3fa] Fix wal_consistency_checking enhanced desc output.
+-->
+
+<listitem>
+<para>
+Improve descriptions of pg_walinspect WAL record descriptions (Melanie Plageman, Peter Geoghegan)
+</para>
+</listitem>
+
<!--
Author: Tom Lane <[email protected]>
2023-01-02 [1fd3dd204] Add bt_multi_page_stats() function to contrib/pageinspec
@@ -2994,74 +3054,6 @@ Author: Andres Freund <[email protected]>
<para>
Have postgres_fdw and dblink handle interrupts during connection establishment (Andres Freund)
</para>
-</listitem>
-
- </itemizedlist>
-
- </sect4>
-
- <sect4 id="release-16-walinspect">
- <title><link linkend="pgwalinspect"><application>pg_walinspect</application></link></title>
-
- <itemizedlist>
-
-<!--
-Author: Michael Paquier <[email protected]>
-2023-01-23 [c31cf1c03] pg_walinspect: Add pg_get_wal_fpi_info()
-Author: Michael Paquier <[email protected]>
-2023-03-10 [9ecb134a9] pg_walinspect: pg_get_wal_fpi_info() -> pg_get_wal_block
--->
-
-<listitem>
-<para>
-Add pg_walinspect function pg_get_wal_block() to report WAL block information (Michael Paquier, Melanie Plageman, Bharath Rupireddy)
-</para>
-</listitem>
-
-<!--
-Author: Peter Geoghegan <[email protected]>
-2023-03-30 [122376f02] Show record information in pg_get_wal_block_info.
-Author: Peter Geoghegan <[email protected]>
-2023-03-31 [df4f3ab51] Add show_data option to pg_get_wal_block_info.
--->
-
-<listitem>
-<para>
-Add output fields to pg_walinspect's function pg_get_wal_block_info() (Bharath Rupireddy, Peter Geoghegan)
-</para>
-</listitem>
-
-<!--
-Author: Michael Paquier <[email protected]>
-2023-03-14 [5c1b66280] Rework design of functions in pg_walinspect
--->
-
-<listitem>
-<para>
-Change how pg_walinspect functions pg_get_wal_records_info(), pg_get_wal_stats(), and pg_get_wal_block_info() interpret ending LSNs (Bharath Rupireddy)
-</para>
-
-<para>
-Previously ending LSNs which represent nonexistent WAL locations would generate an error, while they will now be interpreted as the end of the WAL. Functions pg_get_wal_records_info_till_end_of_wal() and
-pg_get_wal_stats_till_end_of_wal() have been removed.
-</para>
-</listitem>
-
-<!--
-Author: Peter Geoghegan <[email protected]>
-2023-04-07 [7d8219a44] Show more detail in heapam rmgr descriptions.
-Author: Peter Geoghegan <[email protected]>
-2023-04-07 [1c453cfd8] Show more detail in nbtree rmgr descriptions.
-Author: Peter Geoghegan <[email protected]>
-2023-04-11 [96149a180] Fix Heap rmgr's desc output for infobits arrays.
-Author: Peter Geoghegan <[email protected]>
-2023-04-19 [50547a3fa] Fix wal_consistency_checking enhanced desc output.
--->
-
-<listitem>
-<para>
-Improve descriptions of pg_walinspect WAL record descriptions (Melanie Plageman, Peter Geoghegan)
-</para>
</listitem>
</itemizedlist>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PG 16 draft release notes ready
@ 2023-05-19 02:15 Peter Geoghegan <[email protected]>
parent: Bruce Momjian <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: Peter Geoghegan @ 2023-05-19 02:15 UTC (permalink / raw)
To: Bruce Momjian <[email protected]>; +Cc: pgsql-hackers
On Thu, May 18, 2023 at 6:44 PM Bruce Momjian <[email protected]> wrote:
> > I don't understand what you mean by that. The changes to
> > *_till_end_of_wal() (the way that those duplicative functions were
> > removed, and more permissive end_lsn behavior was added) is unrelated
> > to all of the other changes. Plus it's just not very important.
>
> I see what you mean now. I have moved the function removal to the
> incompatibilities section and kept the existing entry but remove the
> text about the removed functions.
Your patch now has two separate items for "[5c1b66280] Rework design
of functions in pg_walinspect", but even one item is arguably one too
many. The "ending LSN" item (the second item for this same commit)
should probably be removed altogether. If you're going to keep the
sentences that appear under that second item, then it should at least
be consolidated with the first item, in order that commit 5c1b66280
isn't listed twice.
Note also that the patch doesn't remove a remaining reference to an
update in how pg_get_wal_block_info() works, which (as I've said) is a
brand new function as far as users are concerned. Users don't need to
hear that it has been updated, since these release notes will also be
the first time they've been presented with any information about
pg_get_wal_block_info(). (This isn't very important; again, I suggest
that you avoid saying anything about any specific function, even if
you feel strongly that the "ending LSN" issue must be spelled out like
this.)
> > There is pretty much one truly new piece of functionality added to
> > pg_walinspect (the function called pg_get_wal_block_info was added) --
> > since the enhancement to rmgr description output applies equally to
> > pg_waldump, no matter where you place it in the release notes. So not
> > sure what you mean.
>
> I see what you mean now. I have removed the mention of
> pg_get_wal_block_info() and moved the three items back into the
> extension section since there are only three pg_walinspect items now.
The wording for this item as it appears in the patch is: "Improve
descriptions of pg_walinspect WAL record descriptions". I suggest the
following wording be used instead: "Provide more detailed descriptions
of certain WAL records in the output of pg_walinspect and pg_waldump".
--
Peter Geoghegan
^ permalink raw reply [nested|flat] 3+ messages in thread
* [PATCH] Add hook for plugins to acquire sample rows during ANALYZE
@ 2026-05-29 12:35 Samba Siva <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: Samba Siva @ 2026-05-29 12:35 UTC (permalink / raw)
- Introduced AcquireSampleRowsFunc_hook for extensions to override row sampling.
- Updated analyze.c to utilize the hook if registered.
- Added tests to ensure ANALYZE completes without errors with the new hook.
---
doc/src/sgml/xfunc.sgml | 10 ++++++++++
src/backend/commands/analyze.c | 24 ++++++++++++++++++++----
src/include/commands/vacuum.h | 11 +++++++++++
src/test/regress/expected/analyze.out | 20 ++++++++++++++++++++
src/test/regress/parallel_schedule | 1 +
src/test/regress/sql/analyze.sql | 24 ++++++++++++++++++++++++
6 files changed, 86 insertions(+), 4 deletions(-)
create mode 100644 src/test/regress/expected/analyze.out
create mode 100644 src/test/regress/sql/analyze.sql
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index 1eb5abffd8..f1ef025ae2 100644
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -4203,4 +4203,14 @@ supportfn(internal) returns internal
To create such conditions, the support function must implement
the <literal>SupportRequestIndexCondition</literal> request type.
</para>
+
+ <para>
+ The hook variable <varname>AcquireSampleRowsFunc_hook</varname> allows extensions
+ to override the row sampling function during <command>ANALYZE</command> for regular
+ heap relations. This is useful for extensions/systems which implement distributed
+ databases and want to sample rows from remote nodes instead of the local heap.
+ The hook function fills the provided <literal>rows[]</literal> buffer with at most
+ <literal>targrows</literal> heap tuples and sets <literal>*totalrows</literal> to the
+ estimated total live row count of the relation.
+ </para>
</sect1>
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 4fffb76e55..3560acdff1 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -74,6 +74,8 @@ int default_statistics_target = 100;
static MemoryContext anl_context = NULL;
static BufferAccessStrategy vac_strategy;
+/* Hook for plugins to acquire sample rows for ANALYZE */
+AcquireSampleRowsFunc_hook_type AcquireSampleRowsFunc_hook = NULL;
static void do_analyze_rel(Relation onerel,
VacuumParams *params, List *va_cols,
@@ -188,8 +190,15 @@ analyze_rel(Oid relid, RangeVar *relation,
if (onerel->rd_rel->relkind == RELKIND_RELATION ||
onerel->rd_rel->relkind == RELKIND_MATVIEW)
{
- /* Regular table, so we'll use the regular row acquisition function */
- acquirefunc = acquire_sample_rows;
+ /*
+ * Regular table, so we'll use the regular row acquisition function.
+ * If a plugin has registered a hook to acquire sample rows, use it;
+ * otherwise use the default function.
+ */
+ if (AcquireSampleRowsFunc_hook)
+ acquirefunc = AcquireSampleRowsFunc_hook;
+ else
+ acquirefunc = acquire_sample_rows;
/* Also get regular table's size */
relpages = RelationGetNumberOfBlocks(onerel);
}
@@ -1467,8 +1476,15 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
if (childrel->rd_rel->relkind == RELKIND_RELATION ||
childrel->rd_rel->relkind == RELKIND_MATVIEW)
{
- /* Regular table, so use the regular row acquisition function */
- acquirefunc = acquire_sample_rows;
+ /*
+ * Regular table, so use the regular row acquisition function.
+ * If a plugin has registered a hook to acquire sample rows, use it;
+ * otherwise use the default function.
+ */
+ if (AcquireSampleRowsFunc_hook)
+ acquirefunc = AcquireSampleRowsFunc_hook;
+ else
+ acquirefunc = acquire_sample_rows;
relpages = RelationGetNumberOfBlocks(childrel);
}
else if (childrel->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h
index bc37a80dc7..146f936861 100644
--- a/src/include/commands/vacuum.h
+++ b/src/include/commands/vacuum.h
@@ -21,6 +21,7 @@
#include "catalog/pg_class.h"
#include "catalog/pg_statistic.h"
#include "catalog/pg_type.h"
+#include "foreign/fdwapi.h"
#include "parser/parse_node.h"
#include "storage/buf.h"
#include "storage/lock.h"
@@ -113,6 +114,9 @@ typedef void (*AnalyzeAttrComputeStatsFunc) (VacAttrStatsP stats,
int samplerows,
double totalrows);
+/* Hook type for plugins to acquire sample rows for ANALYZE */
+typedef AcquireSampleRowsFunc AcquireSampleRowsFunc_hook_type;
+
typedef struct VacAttrStats
{
/*
@@ -334,6 +338,13 @@ extern PGDLLIMPORT int vacuum_cost_limit;
extern PGDLLIMPORT int64 parallel_vacuum_worker_delay_ns;
+/*
+ * Hook for plugins to override row sampling during ANALYZE.
+ * Also applies to child relations of partitioned/inherited tables.
+ * See acquire_sample_rows() in src/backend/commands/analyze.c.
+ */
+extern PGDLLIMPORT AcquireSampleRowsFunc_hook_type AcquireSampleRowsFunc_hook;
+
/* in commands/vacuum.c */
extern void ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel);
extern void vacuum(List *relations, VacuumParams *params,
diff --git a/src/test/regress/expected/analyze.out b/src/test/regress/expected/analyze.out
new file mode 100644
index 0000000000..5bb6bbc45b
--- /dev/null
+++ b/src/test/regress/expected/analyze.out
@@ -0,0 +1,20 @@
+-- Test AcquireSampleRowsFunc_hook
+-- Usually this would be tested via a C extension.
+-- Here we just confirm this does not break the existing ANALYZE code
+-- by verifying that ANALYZE completes without error.
+CREATE TABLE employees (
+ id SERIAL PRIMARY KEY,
+ name TEXT,
+ department TEXT,
+ salary NUMERIC
+);
+INSERT INTO employees
+ SELECT
+ i,
+ 'Employee ' || i,
+ 'Department ' || (i % 5),
+ (i % 100) * 1000 + 50000
+ FROM generate_series(1, 1000) i;
+-- Should complete without error
+ANALYZE employees;
+DROP TABLE employees;
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
index e1e0c54019..71978ef858 100644
--- a/src/test/regress/parallel_schedule
+++ b/src/test/regress/parallel_schedule
@@ -94,6 +94,7 @@ test: vacuum_parallel
# Run this alone, because concurrent DROP TABLE would make non-superuser
# "ANALYZE;" fail with "relation with OID $n does not exist".
test: maintain_every
+test: analyze
# no relation related tests can be put in this group
test: publication subscription
diff --git a/src/test/regress/sql/analyze.sql b/src/test/regress/sql/analyze.sql
new file mode 100644
index 0000000000..e0bc84e9f9
--- /dev/null
+++ b/src/test/regress/sql/analyze.sql
@@ -0,0 +1,24 @@
+-- Test AcquireSampleRowsFunc_hook
+-- Usually this would be tested via a C extension.
+-- Here we just confirm this does not break the existing ANALYZE code
+-- by verifying that ANALYZE completes without error.
+
+CREATE TABLE employees (
+ id SERIAL PRIMARY KEY,
+ name TEXT,
+ department TEXT,
+ salary NUMERIC
+);
+
+INSERT INTO employees
+ SELECT
+ i,
+ 'Employee ' || i,
+ 'Department ' || (i % 5),
+ (i % 100) * 1000 + 50000
+ FROM generate_series(1, 1000) i;
+
+-- Should complete without error
+ANALYZE employees;
+
+DROP TABLE employees;
--
2.50.1 (Apple Git-155)
------=_Part_741589_445982825.1782438414800--
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-05-29 12:35 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-05-19 01:44 Re: PG 16 draft release notes ready Bruce Momjian <[email protected]>
2023-05-19 02:15 ` Peter Geoghegan <[email protected]>
2026-05-29 12:35 [PATCH] Add hook for plugins to acquire sample rows during ANALYZE Samba Siva <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox