Skip to content

Commit

Permalink
Add plan, row, and sort information to table
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus Gartner committed Oct 29, 2019
1 parent 2862320 commit c282daa
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 104 deletions.
11 changes: 8 additions & 3 deletions docs/flamegraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@
font-family: monospace;
}

table th {
.table tbody tr th {
padding: 4px 8px;
width: 250px;
}

.table tbody tr td {
padding: 4px 8px;
}

span {
font-weight: 700;
font-family: monospace;
Expand Down Expand Up @@ -104,7 +109,7 @@ <h3 class="text-muted">pg_flame</h3>
.offset([8, 0])
.attr('class', 'd3-flame-graph-tip')
.html(function(d) {
return d.data.name + " | " + d.data.time + "ms";
return d.data.name + " | " + d.data.time + " ms";
});
flameGraph.tooltip(tip);

Expand All @@ -116,7 +121,7 @@ <h3 class="text-muted">pg_flame</h3>
}
flameGraph.label(label);

var data = {"name":"Total","value":71.37,"time":71.37,"detail":"\u003cspan\u003eIncludes planning and execution time\u003c/span\u003e","color":"","init_plan":false,"children":[{"name":"Query Planning","value":8.447,"time":8.447,"detail":"\u003cspan\u003eTime to generate the query plan\u003c/span\u003e","color":"#00C05A","init_plan":false,"children":null},{"name":"Aggregate","value":62.923,"time":62.923,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \u003ctr\u003e\n \u003cth\u003eFilter\u003c/th\u003e\n \u003ctd\u003e(count(*) \u0026gt; 1)\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Hit\u003c/th\u003e\n \u003ctd\u003e2\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Read\u003c/th\u003e\n \u003ctd\u003e813\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":[{"name":"Hash Join","value":60.106,"time":60.106,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eParent Relationship\u003c/th\u003e\n \u003ctd\u003eOuter\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \u003ctr\u003e\n \u003cth\u003eHash Cond\u003c/th\u003e\n \u003ctd\u003e(u.id = posts.user_id)\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Hit\u003c/th\u003e\n \u003ctd\u003e2\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Read\u003c/th\u003e\n \u003ctd\u003e813\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":[{"name":"Seq Scan on users","value":24.358,"time":24.358,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eParent Relationship\u003c/th\u003e\n \u003ctd\u003eOuter\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Hit\u003c/th\u003e\n \u003ctd\u003e2\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Read\u003c/th\u003e\n \u003ctd\u003e729\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":null},{"name":"Hash","value":19.902,"time":19.902,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eParent Relationship\u003c/th\u003e\n \u003ctd\u003eInner\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Read\u003c/th\u003e\n \u003ctd\u003e84\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eHash Buckets\u003c/th\u003e\n \u003ctd\u003e8192\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eHash Batches\u003c/th\u003e\n \u003ctd\u003e1\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eMemory Usage\u003c/th\u003e\n \u003ctd\u003e239 kB\u003c/td\u003e\n \u003c/tr\u003e\n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":[{"name":"Seq Scan on posts","value":18.66,"time":18.66,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \u003ctr\u003e\n \u003cth\u003eFilter\u003c/th\u003e\n \u003ctd\u003e((title)::text ~ \u0026#39;.*sql.*\u0026#39;::text)\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eParent Relationship\u003c/th\u003e\n \u003ctd\u003eOuter\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Read\u003c/th\u003e\n \u003ctd\u003e84\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":null}]}]}]}]};
var data = {"name":"Total","value":50.29,"time":50.29,"detail":"\u003cspan\u003eIncludes planning and execution time\u003c/span\u003e","color":"","init_plan":false,"children":[{"name":"Query Planning","value":1.641,"time":1.641,"detail":"\u003cspan\u003eTime to generate the query plan\u003c/span\u003e","color":"#00C05A","init_plan":false,"children":null},{"name":"Sort","value":48.649,"time":48.649,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \u003ctr\u003e\n \u003cth\u003eMethod\u003c/th\u003e\n \u003ctd\u003eSort\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Cost\u003c/th\u003e\n \u003ctd\u003e2869.01\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Rows\u003c/th\u003e\n \u003ctd\u003e1657\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Width\u003c/th\u003e\n \u003ctd\u003e33\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Total Time\u003c/th\u003e\n \u003ctd\u003e48.649 ms\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Rows\u003c/th\u003e\n \u003ctd\u003e106\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Loops\u003c/th\u003e\n \u003ctd\u003e1\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Hit\u003c/th\u003e\n \u003ctd\u003e821\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eSort Key\u003c/th\u003e\n \u003ctd\u003e[u.id u.email DESC]\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eSort Method\u003c/th\u003e\n \u003ctd\u003equicksort\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eSort Space Used\u003c/th\u003e\n \u003ctd\u003e33 kB\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eSort Space Type\u003c/th\u003e\n \u003ctd\u003eMemory\u003c/td\u003e\n \u003c/tr\u003e\n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":[{"name":"Aggregate","value":48.557,"time":48.557,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \u003ctr\u003e\n \u003cth\u003eMethod\u003c/th\u003e\n \u003ctd\u003eAggregate\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eParent Relationship\u003c/th\u003e\n \u003ctd\u003eOuter\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Cost\u003c/th\u003e\n \u003ctd\u003e2776.27\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Rows\u003c/th\u003e\n \u003ctd\u003e1657\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Width\u003c/th\u003e\n \u003ctd\u003e33\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Total Time\u003c/th\u003e\n \u003ctd\u003e48.557 ms\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Rows\u003c/th\u003e\n \u003ctd\u003e106\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Loops\u003c/th\u003e\n \u003ctd\u003e1\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eFilter\u003c/th\u003e\n \u003ctd\u003e(count(*) \u0026gt; 1)\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Hit\u003c/th\u003e\n \u003ctd\u003e815\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \n \n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":[{"name":"Hash Join","value":46.02,"time":46.02,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \u003ctr\u003e\n \u003cth\u003eMethod\u003c/th\u003e\n \u003ctd\u003eHash Join\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eParent Relationship\u003c/th\u003e\n \u003ctd\u003eOuter\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Cost\u003c/th\u003e\n \u003ctd\u003e2676.85\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Rows\u003c/th\u003e\n \u003ctd\u003e4971\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Width\u003c/th\u003e\n \u003ctd\u003e25\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Total Time\u003c/th\u003e\n \u003ctd\u003e46.02 ms\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Rows\u003c/th\u003e\n \u003ctd\u003e4971\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Loops\u003c/th\u003e\n \u003ctd\u003e1\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eHash Cond\u003c/th\u003e\n \u003ctd\u003e(u.id = posts.user_id)\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Hit\u003c/th\u003e\n \u003ctd\u003e815\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \n \n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":[{"name":"Seq Scan on users","value":12.836,"time":12.836,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \u003ctr\u003e\n \u003cth\u003eMethod\u003c/th\u003e\n \u003ctd\u003eSeq Scan\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eTable\u003c/th\u003e\n \u003ctd\u003eusers\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \u003ctr\u003e\n \u003cth\u003eAlias\u003c/th\u003e\n \u003ctd\u003eu\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eParent Relationship\u003c/th\u003e\n \u003ctd\u003eOuter\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Cost\u003c/th\u003e\n \u003ctd\u003e1731\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Rows\u003c/th\u003e\n \u003ctd\u003e100000\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Width\u003c/th\u003e\n \u003ctd\u003e25\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Total Time\u003c/th\u003e\n \u003ctd\u003e12.836 ms\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Rows\u003c/th\u003e\n \u003ctd\u003e100000\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Loops\u003c/th\u003e\n \u003ctd\u003e1\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Hit\u003c/th\u003e\n \u003ctd\u003e731\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \n \n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":null},{"name":"Hash","value":17.894,"time":17.894,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \u003ctr\u003e\n \u003cth\u003eMethod\u003c/th\u003e\n \u003ctd\u003eHash\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eParent Relationship\u003c/th\u003e\n \u003ctd\u003eInner\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Cost\u003c/th\u003e\n \u003ctd\u003e209\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Rows\u003c/th\u003e\n \u003ctd\u003e4971\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Width\u003c/th\u003e\n \u003ctd\u003e4\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Total Time\u003c/th\u003e\n \u003ctd\u003e17.894 ms\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Rows\u003c/th\u003e\n \u003ctd\u003e4971\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Loops\u003c/th\u003e\n \u003ctd\u003e1\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Hit\u003c/th\u003e\n \u003ctd\u003e84\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \u003ctr\u003e\n \u003cth\u003eHash Buckets\u003c/th\u003e\n \u003ctd\u003e8192\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eHash Batches\u003c/th\u003e\n \u003ctd\u003e1\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eMemory Usage\u003c/th\u003e\n \u003ctd\u003e239 kB\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":[{"name":"Seq Scan on posts","value":16.073,"time":16.073,"detail":"\n\u003ctable class=\"table table-striped table-bordered\"\u003e\n \u003ctbody\u003e\n \n \u003ctr\u003e\n \u003cth\u003eMethod\u003c/th\u003e\n \u003ctd\u003eSeq Scan\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eTable\u003c/th\u003e\n \u003ctd\u003eposts\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \u003ctr\u003e\n \u003cth\u003eAlias\u003c/th\u003e\n \u003ctd\u003eposts\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eParent Relationship\u003c/th\u003e\n \u003ctd\u003eOuter\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Cost\u003c/th\u003e\n \u003ctd\u003e209\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Rows\u003c/th\u003e\n \u003ctd\u003e4971\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003ePlan Width\u003c/th\u003e\n \u003ctd\u003e4\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Total Time\u003c/th\u003e\n \u003ctd\u003e16.073 ms\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Rows\u003c/th\u003e\n \u003ctd\u003e4971\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eActual Loops\u003c/th\u003e\n \u003ctd\u003e1\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \u003ctr\u003e\n \u003cth\u003eFilter\u003c/th\u003e\n \u003ctd\u003e((title)::text ~ \u0026#39;.*sql.*\u0026#39;::text)\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \u003ctr\u003e\n \u003cth\u003eBuffers Shared Hit\u003c/th\u003e\n \u003ctd\u003e84\u003c/td\u003e\n \u003c/tr\u003e\n \n \n \n \n \n \n \n \n \n \u003c/tbody\u003e\n\u003c/table\u003e\n","color":"","init_plan":false,"children":null}]}]}]}]}]};

d3.select("#chart")
.datum(data)
Expand Down
Loading

0 comments on commit c282daa

Please sign in to comment.