Skip to content

refactor: track required columns for from_many subqueries - #282

Draft
jechol wants to merge 1 commit into
ash-project:mainfrom
jechol:perf/collect-projection-fields
Draft

jechol wants to merge 1 commit into
ash-project:mainfrom
jechol:perf/collect-projection-fields

Conversation

@jechol

@jechol jechol commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

This replaces #281, following the suggestion to collect required columns during query construction.

Field references and correlation keys are recorded as expressions and joins are built. The final pass uses this metadata to narrow implicit from_many? selections, without re-scanning expression ASTs. When dependencies cannot be tracked reliably, the original selection is retained.

I've updated the benchmark to compare the upstream base, #281's AST scan, and this implementation with identical dependencies and data.

For the latest Payment query:

The motivation remains easier-to-read SQL; PostgreSQL already prunes unused projections.

Execution integration is in ash-project/ash_postgres#919.

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

This branch has not been deployed

No deployments
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