Skip to content

Commit 9ca99cd

Browse files
committed
Update relpages and reltuples estimates in stand-alone ANALYZE, even if
there's no analyzable attributes or indexes. We also used to report 0 live and dead tuples for such tables, which messed with autovacuum threshold calculations. This fixes bug #4812 reported by George Su. Backpatch back to 8.1.
1 parent 7280fab commit 9ca99cd

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/backend/commands/analyze.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.136 2009/05/05 18:02:11 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.137 2009/05/19 08:30:00 heikki Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -363,19 +363,10 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
363363
}
364364

365365
/*
366-
* Quit if no analyzable columns
366+
* Quit if no analyzable columns and no pg_class update needed.
367367
*/
368-
if (attr_cnt <= 0 && !analyzableindex)
369-
{
370-
/*
371-
* We report that the table is empty; this is just so that the
372-
* autovacuum code doesn't go nuts trying to get stats about a
373-
* zero-column table.
374-
*/
375-
if (update_reltuples)
376-
pgstat_report_analyze(onerel, 0, 0);
368+
if (attr_cnt <= 0 && !analyzableindex && !update_reltuples)
377369
goto cleanup;
378-
}
379370

380371
/*
381372
* Determine how many rows we need to sample, using the worst case from

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