Skip to content

Commit

Permalink
Try dropping foreign keys before indexes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnotestein committed Sep 18, 2023
1 parent c2f8c53 commit 6bc6a80
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions hive/db/db_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,18 @@ def before_massive_sync(cls, last_imported_block: int, hived_head_block: int):
log.info("[MASSIVE] Skipping pre-massive sync hooks")
return

# is_pre_process, drop, create
cls.processing_indexes(True, True, False)

log.info("Dropping foreign keys")
from hive.db.schema import drop_fk

log.info("Dropping FKs")
time_start = perf_counter()
drop_fk(cls.db())
end_time = perf_counter()
elapsed_time = end_time - time_start
log.info("Dropped foreign keys: %.4f s", elapsed_time)

# is_pre_process, drop, create
cls.processing_indexes(True, True, False)


# intentionally disabled since it needs a lot of WAL disk space when switching back to LOGGED
# set_logged_table_attribute(cls.db(), False)
Expand Down

0 comments on commit 6bc6a80

Please sign in to comment.