Skip to content

refactor: prune relationship projections before query execution - #2

Draft
jechol wants to merge 1 commit into
mainfrom
perf/prune-relationship-projections
Draft

jechol wants to merge 1 commit into
mainfrom
perf/prune-relationship-projections

Conversation

@jechol

@jechol jechol commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Companion to jechol/ash_sql#3.

Apply relationship projection pruning immediately before normal reads, lateral relationship loads, aggregate reads and calculation queries execute. Keeping this at the execution boundary lets later calculations, filters and sorts reuse the same relationship join without losing columns.

Add coverage using the existing Post/Comment resources: two calculations on the latest comment, filtering and sorting by another comment field, and loading the complete relationship.

This draft depends on the unreleased ash_sql optimizer. The minimum version is provisionally 0.8.9; confirm the actual release version before upstream submission. Validation used ASH_VERSION=local ASH_SQL_VERSION=local; the default released dependency cannot satisfy this change yet.

Validation:

  • 380 related AshPostgres tests pass against dedicated local test databases.
  • 130 permission/invoice/quotation/contract tests pass in the downstream application.
  • Actual invoice, quotation and contract pages retain matching body/document/preview hashes.
  • The SQL size reduction and debugging rationale are described in the companion PR. A public Docker reproduction includes synthetic Invoice/Product/Payment fixtures and complete SQL.

@jechol jechol changed the title perf: prune relationship projections before query execution refactor: prune relationship projections before query execution Nov 9, 2026
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