From 93ca90559260a5e4ec2e7f031d91847862c7d54d Mon Sep 17 00:00:00 2001
From: Dan Notestein <dan@syncad.com>
Date: Tue, 25 Feb 2025 20:54:51 +0000
Subject: [PATCH] tweaking settings to see if they affect post massivesync call
 times

---
 hive/db/db_state.py | 1 +
 hive/db/schema.py   | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/hive/db/db_state.py b/hive/db/db_state.py
index c13747d41..5c8f4c7a5 100644
--- a/hive/db/db_state.py
+++ b/hive/db/db_state.py
@@ -574,6 +574,7 @@ WHERE table_schema = '{SCHEMA_NAME}' AND table_type = 'BASE TABLE'
 
             if is_initial_massive:
                 cls.vacuum_tables_in_threads([
+                        f"{SCHEMA_NAME}.hive_posts",
                         f"{SCHEMA_NAME}.hive_feed_cache",
                         f"{SCHEMA_NAME}.hive_mentions",
                         f"{SCHEMA_NAME}.hive_communities",
diff --git a/hive/db/schema.py b/hive/db/schema.py
index 69a4fa9d3..27ab72c82 100644
--- a/hive/db/schema.py
+++ b/hive/db/schema.py
@@ -734,10 +734,10 @@ def reset_autovac(db):
     per-table, in the format (autovacuum_threshold, autoanalyze_threshold)."""
 
     autovac_config = {  # vacuum  analyze
-#        'hive_accounts': (50000, 100000),
+        'hive_accounts': (50000, 100000),
         'hive_posts': (2500, 10000),
         'hive_post_tags': (5000, 10000),
-#        'hive_follows': (5000, 5000),
+        'hive_follows': (5000, 5000),
 #        'hive_feed_cache': (5000, 5000),
 #        'hive_reblogs': (5000, 5000),
     }
@@ -753,9 +753,10 @@ ALTER TABLE {SCHEMA_NAME}.{table} SET (autovacuum_vacuum_scale_factor = 0,
 
 
 def set_fillfactor(db):
-    """Initializes/resets FILLFACTOR for tables which are intesively updated"""
+    """Initializes/resets FILLFACTOR for tables which are intensively updated"""
 
-    fillfactor_config = {'hive_posts': 90, 'hive_post_data': 100, 'hive_votes': 100}
+    # Lowered fillfactor for hive_votes table in attempt to speed up update_posts_rshares procedure
+    fillfactor_config = { 'hive_posts': 90, 'hive_post_data': 100, 'hive_votes': 90 }
 
     for table, fillfactor in fillfactor_config.items():
         sql = f"ALTER TABLE {SCHEMA_NAME}.{table} SET (FILLFACTOR = {fillfactor});"
-- 
GitLab