Skip to content

Commit d8b6724

Browse files
author
Vladimir Ershov
committed
Merge branch 'PGPROEE9_6' into PGPROEE9_6_scheduler
2 parents cb933d2 + 97b48b4 commit d8b6724

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

contrib/online_analyze/online_analyze.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,13 +847,36 @@ onlineAnalyzeHookerUtility(
847847
{
848848
VacuumStmt *vac = (VacuumStmt*)parsetree;
849849

850-
tblnames = list_make1(vac->relation);
851-
850+
if (vac->relation)
851+
tblnames = list_make1(vac->relation);
852852
if (vac->options & (VACOPT_VACUUM | VACOPT_FULL | VACOPT_FREEZE))
853+
{
853854
/* optionally with analyze */
854855
op = CK_VACUUM;
856+
857+
/* drop all collected stat */
858+
if (tblnames == NIL)
859+
relstatsInit();
860+
}
855861
else if (vac->options & VACOPT_ANALYZE)
862+
{
856863
op = CK_ANALYZE;
864+
865+
/* should reset all counters */
866+
if (tblnames == NIL)
867+
{
868+
HASH_SEQ_STATUS hs;
869+
OnlineAnalyzeTableStat *rstat;
870+
TimestampTz now = GetCurrentTimestamp();
871+
872+
hash_seq_init(&hs, relstats);
873+
while ((rstat = hash_seq_search(&hs)) != NULL)
874+
{
875+
rstat->changes_since_analyze = 0;
876+
rstat->analyze_timestamp = now;
877+
}
878+
}
879+
}
857880
else
858881
tblnames = NIL;
859882
}

0 commit comments

Comments
 (0)