Skip to content

Commit

Permalink
Combine hot queries with query plan analysis
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Dec 10, 2024
1 parent a986b21 commit c91606f
Show file tree
Hide file tree
Showing 2 changed files with 586 additions and 10 deletions.
13 changes: 13 additions & 0 deletions go/summarize/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,24 @@ func renderHotQueries(md *markdown.MarkDown, queries []HotQueryResult) {
// After the table, list the full queries with their IDs
md.PrintHeader("Query Details", 3)
for i, query := range queries {
hasPlanAnalysis := len(string(query.PlanAnalysis.PlanOutput)) > 0

queryID := fmt.Sprintf("Q%d", i+1)
if hasPlanAnalysis {
queryID += fmt.Sprintf(" (`%s`)", query.PlanAnalysis.Complexity.String())
}

md.PrintHeader(queryID, 4)
md.Println("```sql")
md.Println(query.QueryAnalysisResult.QueryStructure)
md.Println("```")

if hasPlanAnalysis {
md.Println("```json")
md.Println(string(query.PlanAnalysis.PlanOutput))
md.Println("```")
}

md.NewLine()
}
}
Expand Down
Loading

0 comments on commit c91606f

Please sign in to comment.