-
Notifications
You must be signed in to change notification settings - Fork 29
refactor: convert multi-pass to single-pass in plan module #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- groupDiffs: merge three loops into one by tracking creates incrementally (diffs are topologically sorted, so creates come before dependent operations) - calculateSummaryFromSteps: remove pre-scan loop by determining parent type directly from step.Type prefix (table.index, view.index, materialized_view.index) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors two functions in the plan module to convert multi-pass loops into single-pass operations for improved performance and code simplicity.
Changes:
- Merged three separate loops in
groupDiffsinto one by tracking creates incrementally - Eliminated a pre-scan loop in
calculateSummaryFromStepsby determining parent type directly from thestep.Typeprefix - Updated comments to reflect the single-pass approach
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| // Single-pass: process all steps, determining parent type from step.Type prefix | ||
| // Sub-resource types encode their parent: "table.index", "view.index", "materialized_view.index" |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment mentions "view.index" as a sub-resource type, but based on the DiffType constants in internal/diff/diff.go, views only have "view.comment" as a sub-resource. Regular views don't support indexes in PostgreSQL (only materialized views do). The comment should be updated to reflect the actual sub-resource types: "table.index", "view.comment", "materialized_view.index".
Views don't support indexes in PostgreSQL - only materialized views do. Updated comment to show accurate examples: table.index, table.column, view.comment, materialized_view.index. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: convert multi-pass to single-pass in plan module - groupDiffs: merge three loops into one by tracking creates incrementally (diffs are topologically sorted, so creates come before dependent operations) - calculateSummaryFromSteps: remove pre-scan loop by determining parent type directly from step.Type prefix (table.index, view.index, materialized_view.index) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: correct comment about view sub-resource types Views don't support indexes in PostgreSQL - only materialized views do. Updated comment to show accurate examples: table.index, table.column, view.comment, materialized_view.index. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Related #240