diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-06-19 14:01:01 -0400 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-06-19 14:01:01 -0400 |
| commit | ccdce73b2145a0a762188709b89ca73e7d2efcd8 (patch) | |
| tree | 8950a79c70843b2f6b19d748109ff52eeb064bc5 /src | |
| parent | ae7fc61bc3138d4e938f0faf353a92f0fb4d89ca (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/backend/commands/analyze.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 26a0bc25bfb..9e5f0213803 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -252,7 +252,6 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh) Relation *Irel; int nindexes; bool hasindex; - bool analyzableindex; VacAttrStats **vacattrstats; AnlIndexData *indexdata; int targrows, @@ -366,7 +365,6 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh) } hasindex = (nindexes > 0); indexdata = NULL; - analyzableindex = false; if (hasindex) { indexdata = (AnlIndexData *) palloc0(nindexes * sizeof(AnlIndexData)); @@ -400,10 +398,7 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh) thisdata->vacattrstats[tcnt] = examine_attribute(Irel[ind], i + 1, indexkey); if (thisdata->vacattrstats[tcnt] != NULL) - { tcnt++; - analyzableindex = true; - } } } thisdata->attr_cnt = tcnt; @@ -412,15 +407,10 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh) } /* - * Quit if no analyzable columns. - */ - if (attr_cnt <= 0 && !analyzableindex) - goto cleanup; - - /* * Determine how many rows we need to sample, using the worst case from * all analyzable columns. We use a lower bound of 100 rows to avoid - * possible overflow in Vitter's algorithm. + * possible overflow in Vitter's algorithm. (Note: that will also be + * the target in the corner case where there are no analyzable columns.) */ targrows = 100; for (i = 0; i < attr_cnt; i++) @@ -559,9 +549,6 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh) if (!inh) pgstat_report_analyze(onerel, totalrows, totaldeadrows); - /* We skip to here if there were no analyzable columns */ -cleanup: - /* If this isn't part of VACUUM ANALYZE, let index AMs do cleanup */ if (!(vacstmt->options & VACOPT_VACUUM)) { |
