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

Commit992d2ca

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 parent6d2de07 commit992d2ca

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
@@ -1534,8 +1534,25 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
15341534
AcquireSampleRowsFuncacquirefunc=acquirefuncs[i];
15351535
doublechildblocks=relblocks[i];
15361536

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

15401557
if (childblocks>0)
15411558
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp