public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nathan Bossart <[email protected]>
Subject: [PATCH v12 3/3] add booleans to view
Date: Sat, 4 Apr 2026 14:08:43 -0500
---
doc/src/sgml/monitoring.sgml | 43 ++++++++++++++++++++++------
src/backend/catalog/system_views.sql | 5 +++-
src/backend/postmaster/autovacuum.c | 7 +++--
src/include/catalog/pg_proc.dat | 6 ++--
src/test/regress/expected/rules.out | 7 +++--
5 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index b8b2967aa36..3888292bec3 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -4576,13 +4576,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage
</para>
<para>
Maximum value of all component scores. This is the value that
- autovacuum uses to sort the list of tables to process. When the
- "weight" parameters are set to their default values of
- <literal>1.0</literal>, scores greater than or equal to
- <literal>1.0</literal> indicate the table will be processed (unless
- autovacuum is disabled and neither <literal>xid_score</literal> nor
- <literal>mxid_score</literal> are greater than or equal to
- <literal>1.0</literal>).
+ autovacuum uses to sort the list of tables to process.
</para></entry>
</row>
@@ -4593,7 +4587,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage
<para>
Transaction ID age component score. Scores greater than or equal to
<xref linkend="guc-autovacuum-freeze-score-weight"/> indicate the table
- will be vacuumed.
+ will be vacuumed for transaction ID wraparound prevention.
</para></entry>
</row>
@@ -4604,7 +4598,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage
<para>
Multixact ID age component score. Scores greater than or equal to
<xref linkend="guc-autovacuum-multixact-freeze-score-weight"/> indicate
- the table will be vacuumed.
+ the table will be vacuumed for multixact ID wraparound prevention.
</para></entry>
</row>
@@ -4640,6 +4634,37 @@ description | Waiting for a newly initialized WAL file to reach durable storage
will be analyzed (unless autovacuum is disabled).
</para></entry>
</row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>will_vacuum</structfield> <type>bool</type>
+ </para>
+ <para>
+ Whether the table will be vacuumed. Note that even if the component
+ scores indicate that the table needs to be vacuumed, this may be
+ <literal>false</literal> if autovacuum is disabled.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>will_analyze</structfield> <type>bool</type>
+ </para>
+ <para>
+ Whether the table will be analyzed. Note that even if the component
+ scores indicate that the table needs to be analyzed, this may be
+ <literal>false</literal> if autovacuum is disabled.
+ </para></entry>
+ </row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>for_wraparound</structfield> <type>bool</type>
+ </para>
+ <para>
+ Whether the table will be vacuumed for wraparound prevention.
+ </para></entry>
+ </row>
</tbody>
</tgroup>
</table>
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index 5c2f2977965..83cc3edcbeb 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -805,7 +805,10 @@ CREATE VIEW pg_stat_autovacuum_scores AS
s.mxid_score,
s.vacuum_score,
s.vacuum_insert_score,
- s.analyze_score
+ s.analyze_score,
+ s.will_vacuum,
+ s.will_analyze,
+ s.for_wraparound
FROM pg_stat_get_autovacuum_scores() s
JOIN pg_class c on c.oid = s.oid
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace;
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index c6c601dd3ad..26faa9870ba 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -3659,8 +3659,8 @@ pg_stat_get_autovacuum_scores(PG_FUNCTION_ARGS)
bool doanalyze;
bool wraparound;
AutoVacuumScores scores;
- Datum vals[7];
- bool nulls[7] = {false};
+ Datum vals[10];
+ bool nulls[10] = {false};
/* skip ineligible entries */
if (form->relkind != RELKIND_RELATION &&
@@ -3685,6 +3685,9 @@ pg_stat_get_autovacuum_scores(PG_FUNCTION_ARGS)
vals[4] = Float8GetDatum(scores.vac);
vals[5] = Float8GetDatum(scores.vac_ins);
vals[6] = Float8GetDatum(scores.anl);
+ vals[7] = BoolGetDatum(dovacuum);
+ vals[8] = BoolGetDatum(doanalyze);
+ vals[9] = BoolGetDatum(wraparound);
tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, vals, nulls);
}
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 0de3bb52eb2..d79b4465b10 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -5670,9 +5670,9 @@
{ oid => '8409', descr => 'autovacuum scores',
proname => 'pg_stat_get_autovacuum_scores', prorows => '100', proretset => 't',
provolatile => 'v', proparallel => 'u', prorettype => 'record', proargtypes => '',
- proallargtypes => '{oid,float8,float8,float8,float8,float8,float8}',
- proargmodes => '{o,o,o,o,o,o,o}',
- proargnames => '{oid,score,xid_score,mxid_score,vacuum_score,vacuum_insert_score,analyze_score}',
+ proallargtypes => '{oid,float8,float8,float8,float8,float8,float8,bool,bool,bool}',
+ proargmodes => '{o,o,o,o,o,o,o,o,o,o}',
+ proargnames => '{oid,score,xid_score,mxid_score,vacuum_score,vacuum_insert_score,analyze_score,will_vacuum,will_analyze,for_wraparound}',
prosrc => 'pg_stat_get_autovacuum_scores' },
{ oid => '1936', descr => 'statistics: currently active backend IDs',
proname => 'pg_stat_get_backend_idset', prorows => '100', proretset => 't',
diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out
index b167e8d3cab..d978aedbd07 100644
--- a/src/test/regress/expected/rules.out
+++ b/src/test/regress/expected/rules.out
@@ -1868,8 +1868,11 @@ pg_stat_autovacuum_scores| SELECT s.oid AS relid,
s.mxid_score,
s.vacuum_score,
s.vacuum_insert_score,
- s.analyze_score
- FROM ((pg_stat_get_autovacuum_scores() s(oid, score, xid_score, mxid_score, vacuum_score, vacuum_insert_score, analyze_score)
+ s.analyze_score,
+ s.will_vacuum,
+ s.will_analyze,
+ s.for_wraparound
+ FROM ((pg_stat_get_autovacuum_scores() s(oid, score, xid_score, mxid_score, vacuum_score, vacuum_insert_score, analyze_score, will_vacuum, will_analyze, for_wraparound)
JOIN pg_class c ON ((c.oid = s.oid)))
LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace)));
pg_stat_bgwriter| SELECT pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean,
--
2.50.1 (Apple Git-155)
--wLga2yfBuT3a3SD4--
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: [email protected]
Cc: [email protected]
Subject: Re: [PATCH v12 3/3] add booleans to view
In-Reply-To: <no-message-id-601679@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox