Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc181f2e

Browse files
committed
Fix briefly showing old progress stats for ANALYZE on inherited tables.
ANALYZE on a table with inheritance children analyzes all the childtables in a loop. When stepping to next child table, it updated thechild rel ID value in the command progress stats, but did not resetthe 'sample_blks_total' and 'sample_blks_scanned' counters.acquire_sample_rows() updates 'sample_blks_total' as soon as the scanstarts and 'sample_blks_scanned' after processing the first block, butuntil then, pg_stat_progress_analyze would display a bogus combinationof the new child table relid with old counter values from thepreviously processed child table. Fix by resetting 'sample_blks_total'and 'sample_blks_scanned' to zero at the same time that'current_child_table_relid' is updated.Backpatch to v13, where pg_stat_progress_analyze view was introduced.Reported-by: Justin PryzbyDiscussion:https://www.postgresql.org/message-id/20230122162345.GP13860%40telsasoft.com
1 parent1d5caec commitc181f2e

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

‎src/backend/commands/analyze.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,8 +1531,25 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
15311531
AcquireSampleRowsFuncacquirefunc=acquirefuncs[i];
15321532
doublechildblocks=relblocks[i];
15331533

1534-
pgstat_progress_update_param(PROGRESS_ANALYZE_CURRENT_CHILD_TABLE_RELID,
1535-
RelationGetRelid(childrel));
1534+
/*
1535+
* Report progress. The sampling function will normally report blocks
1536+
* done/total, but we need to reset them to 0 here, so that they don't
1537+
* show an old value until that.
1538+
*/
1539+
{
1540+
constintprogress_index[]= {
1541+
PROGRESS_ANALYZE_CURRENT_CHILD_TABLE_RELID,
1542+
PROGRESS_ANALYZE_BLOCKS_DONE,
1543+
PROGRESS_ANALYZE_BLOCKS_TOTAL
1544+
};
1545+
constint64progress_vals[]= {
1546+
RelationGetRelid(childrel),
1547+
0,
1548+
0,
1549+
};
1550+
1551+
pgstat_progress_update_multi_param(3,progress_index,progress_vals);
1552+
}
15361553

15371554
if (childblocks>0)
15381555
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp