Planner: Add comprehensive debug logging for query planner NoRewrite cases#18476
Merged
systay merged 3 commits intovitessio:mainfrom Jul 23, 2025
Merged
Planner: Add comprehensive debug logging for query planner NoRewrite cases#18476systay merged 3 commits intovitessio:mainfrom
systay merged 3 commits intovitessio:mainfrom
Conversation
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Contributor
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
harshit-gangal
approved these changes
Jul 23, 2025
morgo
added a commit
to morgo/vitess
that referenced
this pull request
Jul 29, 2025
…rds-new2 * origin/master: Set up better dependency checks (vitessio#18508) bugfix: Plan group by only on top of derived tables correctly (vitessio#18505) Fix regression in v22 around new flag setup (vitessio#18507) Bump form-data from 4.0.1 to 4.0.4 in /web/vtadmin (vitessio#18473) Bump @babel/runtime from 7.26.0 to 7.27.6 in /web/vtadmin (vitessio#18467) Bump vite from 4.5.9 to 4.5.14 in /web/vtadmin (vitessio#18485) Fix for simple projection showing no fields (vitessio#18489) log.Info -> log.Infof in tabletserver for reloading ACLs (vitessio#18461) Fix scalar aggregation with literals in empty result sets (vitessio#18477) Avoid terminating atomic copy workflows on error if they are out of copy phase (vitessio#18475) Update runners to use cncf oracle vms (vitessio#18425) fix: handle aliases in UNIONs better (vitessio#18484) VReplication: Fix bug while reading _vt.vreplication record (vitessio#18478) Planner: Add comprehensive debug logging for query planner NoRewrite cases (vitessio#18476) Update email in Maintainers file (vitessio#18472) tablet manager's `ExecuteFetchAsDba` does not allow multiple queries (vitessio#18183) Signed-off-by: Morgan Tocker <tocker@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds detailed debug logging throughout the Vitess query planner to explain why specific optimizations are not performed when
DebugOperatorTree = true. Previously, developers only saw that rewrites failed without understanding the specific reasons.The implementation adds a
debugNoRewrite()helper function and comprehensive logging to 50+ NoRewrite cases across key planner functions including horizon push/expand, limit optimization, ordering, filtering, distinct operations, and join merging. Each debug message provides specific context about blocking conditions such as phase restrictions, dependency mismatches, routing incompatibilities, or structural limitations.This greatly improves the debugging experience for query plan optimization, making it much easier to understand why certain optimizations fail and how to address performance issues in distributed queries.
Checklist