Relation *Irel;
int nindexes;
bool hasindex;
- bool analyzableindex;
VacAttrStats **vacattrstats;
AnlIndexData *indexdata;
int targrows,
}
hasindex = (nindexes > 0);
indexdata = NULL;
- analyzableindex = false;
if (hasindex)
{
indexdata = (AnlIndexData *) palloc0(nindexes * sizeof(AnlIndexData));
thisdata->vacattrstats[tcnt] =
examine_attribute(Irel[ind], i + 1, indexkey);
if (thisdata->vacattrstats[tcnt] != NULL)
- {
tcnt++;
- analyzableindex = true;
- }
}
}
thisdata->attr_cnt = tcnt;
}
}
- /*
- * 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++)
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))
{