mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
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.
This commit is contained in:
parent
5379bf74d7
commit
18b185cdf0
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.89.2.2 2008/01/03 21:24:26 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.89.2.3 2009/05/19 08:30:24 heikki Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -313,22 +313,10 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Quit if no analyzable columns
|
* Quit if no analyzable columns and no pg_class update needed.
|
||||||
*/
|
*/
|
||||||
if (attr_cnt <= 0 && !analyzableindex)
|
if (attr_cnt <= 0 && !analyzableindex && vacstmt->vacuum)
|
||||||
{
|
|
||||||
/*
|
|
||||||
* We report that the table is empty; this is just so that the
|
|
||||||
* autovacuum code doesn't go nuts trying to get stats about a
|
|
||||||
* zero-column table.
|
|
||||||
*/
|
|
||||||
if (!vacstmt->vacuum)
|
|
||||||
pgstat_report_analyze(RelationGetRelid(onerel),
|
|
||||||
onerel->rd_rel->relisshared,
|
|
||||||
0, 0);
|
|
||||||
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine how many rows we need to sample, using the worst case from
|
* Determine how many rows we need to sample, using the worst case from
|
||||||
|
Loading…
x
Reference in New Issue
Block a user