A query for detecting cyclic joins in QL#22093
Open
josefs wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new QL performance-oriented query (CyclicJoin.ql) intended to locate non-recursive predicate bodies and query where clauses whose join graph contains irreducible cycles (triangles or chordless cycles of length 4–10), as an aid to understanding / auditing join structure.
Changes:
- Introduces
ql/ql/src/queries/performance/CyclicJoin.ql, implementing detection/reporting of cyclic joins up to length 10. - Reports the enclosing scope and a descriptive message including cycle length and involved variables.
Show a summary per file
| File | Description |
|---|---|
| ql/ql/src/queries/performance/CyclicJoin.ql | New query that enumerates irreducible cyclic joins (3–10) within predicate/select scopes and reports them. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Low
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.
A query for detecting cyclic joins. This is an artifact of me trying to understand joins in QL better. It's a one-off query but I though it could be nice to save it for posterity.
There are plenty of cyclic joins in QL, but based on a preliminary analysis by copilot, we spend approximately 0% of time in these joins.
This query only has cycle lengths up to 10. There isn't a way to write a general query to catch all lengths of cycles (copilot says so, and I have no idea what such a query would even look like so I agree).