Skip to content
Snippets Groups Projects
Commit 5c04a191 authored by Bartek Wrona's avatar Bartek Wrona
Browse files

Merge branch 'mi_vacuum_only_for_massive_sync' into 'develop'

vacuuming hive_posts only for massive sync

See merge request !411
parents e71379fe e0acd36f
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!411vacuuming hive_posts only for massive sync
......@@ -250,6 +250,13 @@ class DbState:
force_index_rebuild = True
massive_sync_preconditions = True
def vacuum_hive_posts():
if massive_sync_preconditions:
time_start = perf_counter()
DbState.db().query_no_return( "VACUUM ANALYZE hive_posts" )
time_end = perf_counter()
log.info("[INIT] VACUUM ANALYZE hive_posts executed in %.4fs", time_end - time_start)
#is_pre_process, drop, create
cls.processing_indexes( False, force_index_rebuild, True )
......@@ -276,10 +283,7 @@ class DbState:
time_end = perf_counter()
log.info("[INIT] update_hive_posts_children_count executed in %.4fs", time_end - time_start)
time_start = perf_counter()
DbState.db().query_no_return( "VACUUM ANALYZE hive_posts" )
time_end = perf_counter()
log.info("[INIT] VACUUM ANALYZE hive_posts executed in %.4fs", time_end - time_start)
vacuum_hive_posts()
time_start = perf_counter()
# Update root_id all root posts
......@@ -290,10 +294,7 @@ class DbState:
time_end = perf_counter()
log.info("[INIT] update_hive_posts_root_id executed in %.4fs", time_end - time_start)
time_start = perf_counter()
DbState.db().query_no_return( "VACUUM ANALYZE hive_posts" )
time_end = perf_counter()
log.info("[INIT] VACUUM ANALYZE hive_posts executed in %.4fs", time_end - time_start)
vacuum_hive_posts()
time_start = perf_counter()
......@@ -313,14 +314,10 @@ class DbState:
time_end = perf_counter()
log.info("[INIT] update_all_posts_active executed in %.4fs", time_end - time_start)
time_start = perf_counter()
DbState.db().query_no_return( "VACUUM ANALYZE hive_posts" )
time_end = perf_counter()
log.info("[INIT] VACUUM ANALYZE hive_posts executed in %.4fs", time_end - time_start)
vacuum_hive_posts()
time_start = perf_counter()
sql = """
SELECT update_feed_cache({}, {});
""".format(last_imported_block, current_imported_block)
......@@ -362,7 +359,8 @@ class DbState:
DbState.db().query_no_return(sql)
time_end = perf_counter()
log.info("[INIT] update_posts_rshares executed in %.4fs", time_end - time_start)
# add here 'vacuum analyze hive_posts' when You want to add below more actions which update hive_posts table
vacuum_hive_posts()
time_start = perf_counter()
sql = """
......@@ -393,10 +391,11 @@ class DbState:
log.info("Recreating FKs")
create_fk(cls.db())
time_start = perf_counter()
DbState.db().query_no_return( "VACUUM ANALYZE" )
time_end = perf_counter()
log.info("[INIT] VACUUM ANALYZE executed in %.4fs", time_end - time_start)
time_start = perf_counter()
DbState.db().query_no_return( "VACUUM ANALYZE" )
time_end = perf_counter()
log.info("[INIT] VACUUM ANALYZE executed in %.4fs", time_end - time_start)
@staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment