From c9269992af6697609f1f5cb549ade03bab4cf1ba Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Fri, 7 Apr 2017 17:20:25 +0300 Subject: [PATCH 1/1] reduce stat rereads --- online_analyze.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; -- 2.46.1