|
13 | 13 | *
|
14 | 14 | *
|
15 | 15 | * IDENTIFICATION
|
16 |
| - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.321 2006/01/18 20:35:05 tgl Exp $ |
| 16 | + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.322 2006/02/11 16:59:09 momjian Exp $ |
17 | 17 | *
|
18 | 18 | *-------------------------------------------------------------------------
|
19 | 19 | */
|
@@ -719,7 +719,8 @@ vac_update_relstats(Oid relid, BlockNumber num_pages, double num_tuples,
|
719 | 719 | /* overwrite the existing statistics in the tuple */
|
720 | 720 | pgcform= (Form_pg_class)GETSTRUCT(&rtup);
|
721 | 721 | pgcform->relpages= (int32)num_pages;
|
722 |
| -pgcform->reltuples= (float4)num_tuples; |
| 722 | +if (num_tuples >=0 ) |
| 723 | +pgcform->reltuples= (float4)num_tuples; |
723 | 724 | pgcform->relhasindex=hasindex;
|
724 | 725 |
|
725 | 726 | /*
|
@@ -2961,15 +2962,18 @@ scan_index(Relation indrel, double num_tuples)
|
2961 | 2962 | if (!stats)
|
2962 | 2963 | return;
|
2963 | 2964 |
|
2964 |
| -/* now update statistics in pg_class */ |
| 2965 | +/* now update statistics in pg_class |
| 2966 | + * we use the number of tuples from the table because we have not |
| 2967 | + * actually scanned the index, so don't know the number of tuples in index |
| 2968 | + */ |
2965 | 2969 | vac_update_relstats(RelationGetRelid(indrel),
|
2966 |
| -stats->num_pages,stats->num_index_tuples, |
| 2970 | +stats->num_pages,num_tuples, |
2967 | 2971 | false);
|
2968 | 2972 |
|
2969 | 2973 | ereport(elevel,
|
2970 | 2974 | (errmsg("index \"%s\" now contains %.0f row versions in %u pages",
|
2971 | 2975 | RelationGetRelationName(indrel),
|
2972 |
| -stats->num_index_tuples, |
| 2976 | +num_tuples, |
2973 | 2977 | stats->num_pages),
|
2974 | 2978 | errdetail("%u index pages have been deleted, %u are currently reusable.\n"
|
2975 | 2979 | "%s.",
|
|