File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -847,13 +847,38 @@ onlineAnalyzeHookerUtility(
847
847
{
848
848
VacuumStmt * vac = (VacuumStmt * )parsetree ;
849
849
850
- tblnames = list_make1 (vac -> relation );
850
+ if (vac -> relation )
851
+ tblnames = list_make1 (vac -> relation );
851
852
852
853
if (vac -> options & (VACOPT_VACUUM | VACOPT_FULL | VACOPT_FREEZE ))
854
+ {
853
855
/* optionally with analyze */
854
856
op = CK_VACUUM ;
857
+
858
+ /* drop all collected stat */
859
+ if (tblnames == NIL )
860
+ relstatsInit ();
861
+ }
855
862
else if (vac -> options & VACOPT_ANALYZE )
863
+ {
856
864
op = CK_ANALYZE ;
865
+
866
+ /* should reset all counters */
867
+ if (tblnames == NIL )
868
+ {
869
+ HASH_SEQ_STATUS hs ;
870
+ OnlineAnalyzeTableStat * rstat ;
871
+ TimestampTz now = GetCurrentTimestamp ();
872
+
873
+ hash_seq_init (& hs , relstats );
874
+
875
+ while ((rstat = hash_seq_search (& hs )) != NULL )
876
+ {
877
+ rstat -> changes_since_analyze = 0 ;
878
+ rstat -> analyze_timestamp = now ;
879
+ }
880
+ }
881
+ }
857
882
else
858
883
tblnames = NIL ;
859
884
}
You can’t perform that action at this time.
0 commit comments