-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rohit Nayak <[email protected]>
- Loading branch information
1 parent
d82bd47
commit 06667ee
Showing
5 changed files
with
177 additions
and
208 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,182 @@ | ||
{{define "content"}} | ||
<h1 class="fixed-header">Query Analysis Report</h1> | ||
<br><br> | ||
<h2>Tables</h2> | ||
<h1>Query Analysis Report</h1> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Table Name</th> | ||
<th>Reads</th> | ||
<th>Writes</th> | ||
<th>Number of Rows</th> | ||
<th> Date of Analysis</th> | ||
<th>Analyzed Files</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range .Tables}} | ||
<tr> | ||
<td>{{.Table}}</td> | ||
<td>{{.ReadQueryCount}}</td> | ||
<td>{{.WriteQueryCount}}</td> | ||
<td>{{.RowCount}}</td> | ||
<td style="text-align: center">{{.DateOfAnalysis}}</td> | ||
<td style="text-align: center;font-size: larger">{{range .AnalyzedFiles}}<code>{{.}}</code>{{end}}</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</thead> | ||
</table> | ||
|
||
{{end}} | ||
` | ||
<button class="collapsible">Top Queries</button> | ||
<div class="content"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Query ID</th> | ||
<th>Usage Count</th> | ||
<th>Total Query Time (ms)</th> | ||
<th>Avg Query Time (ms)</th> | ||
<th>Total Rows Examined</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range $index, $query := .HotQueries}} | ||
<tr> | ||
<td>{{$index | add 1}}</td> <!-- Add 1 to start numbering from 1 --> | ||
<td>{{$query.UsageCount}}</td> | ||
<td>{{$query.QueryTime}}</td> | ||
<td>{{divide .QueryTime .UsageCount}}</td> | ||
<td>{{$query.RowsExamined}}</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<button class="collapsible">Query Details</button> | ||
<div class="content"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>#</th> | ||
<th>Query Structure</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range $index, $query := .HotQueries}} | ||
<tr> | ||
<td style="text-align: right">{{$index | add 1}}</td> | ||
<td style="text-align: left"><code>{{.QueryStructure}}</code></td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<button class="collapsible">Tables</button> | ||
<div class="content"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Table Name</th> | ||
<th>Reads</th> | ||
<th>Writes</th> | ||
<th>Number of Rows</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range .Tables}} | ||
<tr> | ||
<td>{{.Table}}</td> | ||
<td>{{.ReadQueryCount}}</td> | ||
<td>{{.WriteQueryCount}}</td> | ||
<td>{{.RowCount}}</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<button class="collapsible">Column Usage</button> | ||
<div class="content" style="margin-bottom: 10px"> | ||
{{range .Tables}} | ||
<div class="columnUsage"> | ||
<h4>Table: <code>{{.Table}}</code> ({{.ReadQueryCount}} reads and {{.WriteQueryCount}} writes)</h4> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Column</th> | ||
<th>Position</th> | ||
<th>Used %</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range .GetColumnsSlice}} | ||
<tr> | ||
<td>{{.ColInfo.Name}}</td> | ||
<td>{{.ColInfo.Pos}}</td> | ||
<td>{{.Usage.Percentage}}%</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
{{end}} | ||
</div> | ||
|
||
<button class="collapsible">Tables Joined</button> | ||
<div class="content"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Table 1</th> | ||
<th>Table 2</th> | ||
<th>Occurrences</th> | ||
<th>Predicates</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range .Joins}} | ||
<tr> | ||
<td><pre>{{.Tbl1}}</pre></td> | ||
<td><pre>{{.Tbl2}}</pre></td> | ||
<td>{{.Occurrences}}</td> | ||
<td style="text-align: left"> | ||
{{range .Predicates}} | ||
<pre>{{.}}</pre> | ||
{{end}} | ||
</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<button class="collapsible">Failures</button> | ||
<div class="content"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Error</th> | ||
<th>Count</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range .Failures}} | ||
<tr> | ||
<td>{{.Error}}</td> | ||
<td>{{.Count}}</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<button class="collapsible">Transaction Patterns</button> | ||
<div class="content"> | ||
{{range $index, $tx := .Transactions}} | ||
<h3>Pattern {{$index | add 1}} (Observed {{$tx.Count}} times)</h3> | ||
<p><strong>Tables Involved:</strong> TBD</p> | ||
<h4>Query Patterns</h4> | ||
{{range $index2, $query := .Queries}} | ||
<p>{{$index | add 1}} . <strong>{{$query.Type}}</strong> on <code>{{$query.Table}}</code></p> | ||
<p>Predicates: {{range $query.Predicates}}{{.}} AND {{end}}</p> | ||
{{end}} | ||
<h4>Shared Predicate Values</h4> | ||
{{range $index3, $join := $tx.Joins}} | ||
<p>Value {{$index | add 1}} applied to:</p> | ||
<ul> | ||
{{range .}} | ||
<li>{{$join}}</li> | ||
{{end}} | ||
</ul> | ||
{{end}} | ||
{{end}} | ||
</div> | ||
{{end}} |
Oops, something went wrong.