File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -847,13 +847,36 @@ onlineAnalyzeHookerUtility(
847
847
{
848
848
VacuumStmt * vac = (VacuumStmt * )parsetree ;
849
849
850
- tblnames = list_make1 (vac -> relation );
851
-
850
+ if (vac -> relation )
851
+ tblnames = list_make1 ( vac -> relation );
852
852
if (vac -> options & (VACOPT_VACUUM | VACOPT_FULL | VACOPT_FREEZE ))
853
+ {
853
854
/* optionally with analyze */
854
855
op = CK_VACUUM ;
856
+
857
+ /* drop all collected stat */
858
+ if (tblnames == NIL )
859
+ relstatsInit ();
860
+ }
855
861
else if (vac -> options & VACOPT_ANALYZE )
862
+ {
856
863
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
+ }
857
880
else
858
881
tblnames = NIL ;
859
882
}
You can’t perform that action at this time.
0 commit comments