Skip to content

perf(catalog): reuse loaded catalog state in pending_sync_rows - #22

Open
aditya3799 wants to merge 1 commit into
Evokoa:mainfrom
aditya3799:perf/reuse-catalog-state
Open

perf(catalog): reuse loaded catalog state in pending_sync_rows#22
aditya3799 wants to merge 1 commit into
Evokoa:mainfrom
aditya3799:perf/reuse-catalog-state

Conversation

@aditya3799

Copy link
Copy Markdown

What does this PR do?

Building on the excellent optimization in #19, this PR removes the remaining redundant catalog reads from the ensure_current_graph() hot path.

Currently, even after #19 removes the duplicate lookup in current_catalog_state(), the very next line calls pending_sync_rows(). This triggers a full read_catalog() via SyncReplayContext::load(), which means ensure_current_graph() is still reading the entire catalog a second time (including executing two massive SPI queries for _registered_tables and _registered_edges).

How it works

This PR extracts the applicable_table_oids from the catalog_state that we already loaded at the top of ensure_current_graph(), and passes them directly down into pending_sync_rows.

By bypassing SyncReplayContext::load(), we completely eliminate all redundant SPI catalog queries from the traversal setup cost. This should completely eliminate the remainder of the ~3.5ms unamortized floor identified in the parent issue.

Checklist

  • Extracted OIDs from existing catalog_state in runtime.rs
  • Passed OIDs through sql_sync.rs direct functions
  • Updated _pending_sync_rows_for_current_role ABI in admin.rs

Closes #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance: Redundant catalog read in pending_sync_rows() which increases fetch time

1 participant