diff --git a/hive/db/db_state.py b/hive/db/db_state.py
index 4566106319d360d1957ae1a7db3b0fe636619ef1..a4cda715ab674c18a78b95c004cbc8384210f911 100644
--- a/hive/db/db_state.py
+++ b/hive/db/db_state.py
@@ -491,6 +491,10 @@ class DbState:
         cls.processing_indexes( False, force_index_rebuild, True )
         log.info("Creating indexes: finished")
 
+        # Update statistics and execution plans after index creation.
+        if massive_sync_preconditions:
+          cls._execute_query(cls.db(),"VACUUM (VERBOSE,ANALYZE)")
+
         #all post-updates are executed in different threads: one thread per one table
         log.info("Filling tables with final values: started")
         cls._finish_all_tables(massive_sync_preconditions, last_imported_block, current_imported_block)