#endif
static void
-makeAnalyze(Oid relOid, CmdType operation, uint32 naffected)
+makeAnalyze(Oid relOid, CmdType operation, int32 naffected)
{
PgStat_StatTabEntry *tabentry;
TimestampTz now = GetCurrentTimestamp();
if (relOid == InvalidOid)
return;
+ if (naffected == 0)
+ /* return if there is not changes */
+ return;
+ else if (naffected < 0)
+ /* number if affected rows is unknown */
+ naffected = 0;
+
if (get_rel_relkind(relOid) != RELKIND_RELATION)
return;
void
onlineAnalyzeHooker(QueryDesc *queryDesc)
{
- uint32 naffected = 0;
+ uint32 naffected = -1;
if (queryDesc->estate)
naffected = queryDesc->estate->es_processed;
if (tblname) {
Oid tblOid = RangeVarGetRelid(tblname, NoLock, true);
- makeAnalyze(tblOid, CMD_INSERT, 0);
+ makeAnalyze(tblOid, CMD_INSERT, -1);
}
}
#endif