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

Merge branch 'mi_vaccum_at_sync_final' into 'develop'

vaccum at sync final

See merge request !395
parents cacfb073 a78090f4
Branches pyup-scheduled-update-2019-09-16
No related tags found
2 merge requests!456Release candidate v1 24,!395vaccum at sync final
......@@ -278,16 +278,24 @@ class DbState:
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)
time_start = perf_counter()
# Update root_id all root posts
sql = """
select update_hive_posts_root_id({}, {})
""".format(last_imported_block, current_imported_block)
row = DbState.db().query_row(sql)
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)
time_start = perf_counter()
# Update root_id all root posts
......@@ -307,6 +315,12 @@ class DbState:
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)
time_start = perf_counter()
sql = """
SELECT update_feed_cache({}, {});
......@@ -349,6 +363,7 @@ 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
time_start = perf_counter()
sql = """
......@@ -379,6 +394,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)
@staticmethod
def status():
......
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