Skip to content

Reduce ORM over-hydration in dimensions graph traversal - #2436

Draft
shangyian wants to merge 2 commits into
mainfrom
perf/node-dimensions-hydration
Draft

Reduce ORM over-hydration in dimensions graph traversal#2436
shangyian wants to merge 2 commits into
mainfrom
perf/node-dimensions-hydration

Conversation

@shangyian

Copy link
Copy Markdown
Collaborator

Summary

  • get_dimension_nodes now uses a trimmed down set of load options (only what get_dimension_attributes actually needs) instead of the full _node_output_options() chain.
  • Batch-load the dimension nodes referenced via col.dimension_id across all candidate columns in a single query, instead of issuing refreshes on each column inside build_reference_link (this is N+1 across every column of every discovered dimension node). build_reference_link now accepts an optional pre-loaded dimension_node to skip those refreshes entirely.
  • get_metric_parents_map's Node selects are trimmed down to only load the fields that are used.

Test Plan

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

Deployment Plan

…rsal

- get_dimension_nodes now uses a slim option set (only what
  get_dimension_attributes actually reads) instead of the full
  _node_output_options() chain, dropping unused parents/dimension_links/
  tags/owners/catalog/Column.dimension/partition eager loads.
- Batch-load the dimension nodes referenced via col.dimension_id across all
  candidate columns in a single query, instead of issuing
  session.refresh(col, ["dimension"]) plus three more refreshes per column
  inside build_reference_link (N+1 across every column of every discovered
  dimension node). build_reference_link now accepts an optional pre-loaded
  dimension_node to skip those refreshes entirely.
- get_metric_parents_map's Node selects now use load_only(id, name, type,
  current_version) plus noload(created_by)/noload(tags), since only those
  four fields are read off the parent nodes by this function and its
  callers.
@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for thriving-cassata-78ae72 canceled.

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

…mension_attributes

Adds a test where a source column has a valid dimension_id/dimension_column
pair but the target column name no longer exists on the referenced
dimension node's current columns, so build_reference_link returns None and
the candidate is skipped. This exercises the 481->480 loop-continuation
branch in get_dimension_attributes that no test previously reached.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant