diff options
Diffstat (limited to 'src/backend/commands/vacuum.c')
-rw-r--r-- | src/backend/commands/vacuum.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index c6ebdd5770b..ececa0c0732 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.326 2006/03/31 23:32:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.327 2006/05/02 11:28:54 teodor Exp $ * *------------------------------------------------------------------------- */ @@ -2982,7 +2982,16 @@ scan_index(Relation indrel, double num_tuples) /* * Check for tuple count mismatch. If the index is partial, then it's OK * for it to have fewer tuples than the heap; else we got trouble. + * + * XXX Hack. Since GIN stores every pointer to heap several times and + * counting num_index_tuples during vacuum is very comlpex and slow + * we just copy num_tuples to num_index_tuples as upper limit to avoid + * WARNING and optimizer mistakes. */ + if ( indrel->rd_rel->relam == GIN_AM_OID ) + { + stats->num_index_tuples = num_tuples; + } else if (stats->num_index_tuples != num_tuples) { if (stats->num_index_tuples > num_tuples || @@ -3052,7 +3061,16 @@ vacuum_index(VacPageList vacpagelist, Relation indrel, /* * Check for tuple count mismatch. If the index is partial, then it's OK * for it to have fewer tuples than the heap; else we got trouble. + * + * XXX Hack. Since GIN stores every pointer to heap several times and + * counting num_index_tuples during vacuum is very comlpex and slow + * we just copy num_tuples to num_index_tuples as upper limit to avoid + * WARNING and optimizer mistakes. */ + if ( indrel->rd_rel->relam == GIN_AM_OID ) + { + stats->num_index_tuples = num_tuples; + } else if (stats->num_index_tuples != num_tuples + keep_tuples) { if (stats->num_index_tuples > num_tuples + keep_tuples || |