Skip to content

Narrow eager-load options on hot SQL/data read paths - #2441

Draft
shangyian wants to merge 1 commit into
mainfrom
perf/sql-data-load-options
Draft

Narrow eager-load options on hot SQL/data read paths#2441
shangyian wants to merge 1 commit into
mainfrom
perf/sql-data-load-options

Conversation

@shangyian

Copy link
Copy Markdown
Collaborator

Summary

  • internal/sql.py's build_node_sql: load only the current revision's catalog + engines instead of the full default chain.
  • api/data.py's get_data / get_data_stream_for_node: similar to the above, load only the catalog + engines, which are used to choose the right engine.
  • api/sql.py's get_sql_for_metrics: switch to a column select instead of hydrating the full Node ORM obj.
  • api/metrics.py's get_common_dimensions: load only the columns actually read and avoid fanout to created_by/tags.

Test Plan

  • PR has an associated issue: #
  • make check passes
  • make test shows 100% unit test coverage

Deployment Plan

Node.get_by_name/get_by_names default to a large eager-load graph, and
mapper-level lazy="selectin" on Node.created_by/tags fires even when
options=[] is passed. Narrow the loader chains on the four hottest
call sites to only what's actually consumed:

- internal/sql.py build_node_sql: load only current.catalog.engines
  instead of the full default chain.
- api/data.py get_data / get_data_stream_for_node: same narrow
  catalog+engines chain, used only by resolve_engine and
  node.current.catalog.name.
- api/sql.py get_sql_for_metrics: switch to a column select
  (Node.name, Node.type) instead of materializing Node entities,
  avoiding the mapper-level created_by/tags selectin fan-out.
- api/metrics.py get_common_dimensions: load_only the columns actually
  read (id, name, type, current_version) and noload created_by/tags.
@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit 6fdd88e
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/6a88310feafd8400083fb0e7

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.

1 participant