Skip to content

Commit 63513b2

Browse files
committed
Fix thinko in previous patch to always update pg_class.reltuples/relpages.
I mis-simplified the test where ANALYZE decided if it could get away without doing anything: under the new regime, that's never allowed. Per bug #6068 from Jeff Janes. Back-patch to 8.4, just like previous patch.
1 parent 8a8fbe7 commit 63513b2

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/backend/commands/analyze.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh)
266266
Relation *Irel;
267267
int nindexes;
268268
bool hasindex;
269-
bool analyzableindex;
270269
VacAttrStats **vacattrstats;
271270
AnlIndexData *indexdata;
272271
int targrows,
@@ -380,7 +379,6 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh)
380379
}
381380
hasindex = (nindexes > 0);
382381
indexdata = NULL;
383-
analyzableindex = false;
384382
if (hasindex)
385383
{
386384
indexdata = (AnlIndexData *) palloc0(nindexes * sizeof(AnlIndexData));
@@ -414,27 +412,19 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh)
414412
thisdata->vacattrstats[tcnt] =
415413
examine_attribute(Irel[ind], i + 1, indexkey);
416414
if (thisdata->vacattrstats[tcnt] != NULL)
417-
{
418415
tcnt++;
419-
analyzableindex = true;
420-
}
421416
}
422417
}
423418
thisdata->attr_cnt = tcnt;
424419
}
425420
}
426421
}
427422

428-
/*
429-
* Quit if no analyzable columns.
430-
*/
431-
if (attr_cnt <= 0 && !analyzableindex)
432-
goto cleanup;
433-
434423
/*
435424
* Determine how many rows we need to sample, using the worst case from
436425
* all analyzable columns. We use a lower bound of 100 rows to avoid
437-
* possible overflow in Vitter's algorithm.
426+
* possible overflow in Vitter's algorithm. (Note: that will also be
427+
* the target in the corner case where there are no analyzable columns.)
438428
*/
439429
targrows = 100;
440430
for (i = 0; i < attr_cnt; i++)
@@ -573,9 +563,6 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh)
573563
if (!inh)
574564
pgstat_report_analyze(onerel, totalrows, totaldeadrows);
575565

576-
/* We skip to here if there were no analyzable columns */
577-
cleanup:
578-
579566
/* If this isn't part of VACUUM ANALYZE, let index AMs do cleanup */
580567
if (!(vacstmt->options & VACOPT_VACUUM))
581568
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy