From: Teodor Sigaev Date: Fri, 7 Apr 2017 14:20:25 +0000 (+0300) Subject: reduce stat rereads X-Git-Url: http://sigaev.ru/git/gitweb.cgi?a=commitdiff_plain;h=c9269992af6697609f1f5cb549ade03bab4cf1ba;p=online_analyze.git reduce stat rereads --- diff --git a/online_analyze.c b/online_analyze.c index b2f8199..dba4226 100644 --- a/online_analyze.c +++ b/online_analyze.c @@ -442,6 +442,8 @@ makeAnalyze(Oid relOid, CmdKind operation, int64 naffected) Assert(rstat->tableid == relOid); + elog(NOTICE,"makeAnalyze op:%d %u", operation, naffected); + if (operation != CK_TRUNCATE && (found == false || rstat->rereadStat == true)) { @@ -466,9 +468,6 @@ makeAnalyze(Oid relOid, CmdKind operation, int64 naffected) } } - if (naffected == 0) - rstat->rereadStat = true; - if (newTable || /* force analyze from after truncate */ operation == CK_TRUNCATE || ( @@ -555,6 +554,7 @@ makeAnalyze(Oid relOid, CmdKind operation, int64 naffected) { case CK_INSERT: rstat->n_tuples += naffected; + rstat->rereadStat = false; break; case CK_UPDATE: rstat->n_tuples += naffected; @@ -565,6 +565,7 @@ makeAnalyze(Oid relOid, CmdKind operation, int64 naffected) break; case CK_TRUNCATE: rstat->n_tuples = 0; + rstat->rereadStat = false; break; default: break;