throws StandardException {
TransactionController tc = lcc.getTransactionExecute();
trace(1, "writing new stats (xid=" + tc.getTransactionIdString() + ")");
UUID table = td.getUUID();
DataDictionary dd = lcc.getDataDictionary();
UUIDFactory uf = dd.getUUIDFactory();
// Update the heap row count estimate.
setHeapRowEstimate(tc, td.getHeapConglomerateId(), numRows);
// Invalidate statments accessing the given table.
// Note that due to retry logic, swithcing the data dictionary to
// write mode is done inside invalidateStatements.
invalidateStatements(lcc, td, asBackgroundTask);
// Drop existing index statistics for this index.
dd.dropStatisticsDescriptors(table, index, tc);
// Don't write statistics if the table is empty.
if (numRows == 0) {
trace(2, "empty table, no stats written");
} else {
// Construct and add the statistics entries.
for (int i=0; i < cardinality.length; i++) {
StatisticsDescriptor statDesc = new StatisticsDescriptor(
dd, uf.createUUID(), index, table, "I",
new StatisticsImpl(numRows, cardinality[i]),
i+1);
dd.addDescriptor(statDesc, null,
DataDictionary.SYSSTATISTICS_CATALOG_NUM, true, tc);
}