Skip to content

Commit 755b910

Browse files
committed
Merge branch 'master' of github.com:Preetam/explain-analyzer
2 parents c8670f3 + 2309b90 commit 755b910

File tree

2 files changed

+59
-215
lines changed

2 files changed

+59
-215
lines changed

html/js/app.min.js

Lines changed: 1 addition & 169 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/Analysis.js

Lines changed: 58 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
var m = require("mithril");
22
var BigOFactor = require("./BigOFactor");
33

4-
var Table = function(name, rows, accessType, key) {
4+
var Table = function(name, rows, accessType, key, possibleKeys, keyLength, ref, filtered) {
55
this.name = name;
66
this.rows = rows;
77
this.newRows = rows;
88
this.key = key;
9+
this.possibleKeys = possibleKeys;
10+
this.keyLength = keyLength;
11+
this.ref = ref;
12+
this.filtered = filtered;
913
var t = this;
1014
this.setNewRows = function() {
1115
if (this.value == "") {
@@ -50,29 +54,25 @@ var TablesScalability = function(tables) {
5054
var factor = 1;
5155
return m("div",
5256
m("h4", "Estimation"),
53-
m("table.pure-table", [
54-
m("thead",
55-
m("tr", [
56-
m("th", "Table"),
57-
m("th", "Row count"),
58-
m("th", "Estimated row count"),
59-
])
60-
), // thead
61-
m("tbody",
62-
vnode.state.tables.map(function(o) {
63-
var disabled = false;
64-
if (o.bigO) {
65-
factor *= o.bigO.factor(o.newRows);
66-
} else {
67-
disabled = true;
68-
}
69-
return m("tr",
70-
m("td", o.name),
71-
m("td", o.rows),
72-
m("td", m("input", {value: o.newRows, oninput: o.setNewRows, disabled: disabled}))
73-
)
74-
})
75-
) // tbody
57+
m("table", [
58+
m("tr", [
59+
m("th", "Table"),
60+
m("th", "Row count"),
61+
m("th", "Estimated row count or scale factor"),
62+
]),
63+
vnode.state.tables.map(function(o) {
64+
var disabled = false;
65+
if (o.bigO) {
66+
factor *= o.bigO.factor(o.newRows);
67+
} else {
68+
disabled = true;
69+
}
70+
return m("tr",
71+
m("td", o.name),
72+
m("td", o.rows),
73+
m("td", m("input", {value: o.newRows, oninput: o.setNewRows, disabled: disabled}))
74+
)
75+
})
7676
]),
7777
m("p",
7878
"Latency scale factor: ",
@@ -144,35 +144,47 @@ var Analysis = function(explain) {
144144
this.explain.tables.map(function(o) {
145145
var rows = o.rows_examined_per_scan || o.rows;
146146
vnode.state.tables.push(
147-
new Table(o.table_name, rows, o.access_type, o.key)
147+
new Table(
148+
o.table_name,
149+
o.rows_examined_per_scan,
150+
o.access_type,
151+
o.key,
152+
o.possible_keys,
153+
o.key_length,
154+
o.ref,
155+
o.filtered)
148156
)
149157
})
150158
vnode.state.tablesScalability = new TablesScalability(vnode.state.tables);
151159
vnode.state.commentary = new Comments(vnode.state.tables);
152160
}.bind(this);
153161
this.view = function(vnode) {
154162
return m("div", [
155-
m("table.pure-table", [
156-
m("thead",
157-
m("tr", [
158-
m("th", "Table"),
159-
m("th", "Access type"),
160-
m("th", "Index"),
161-
m("th", "Rows examined per scan"),
162-
m("th", "Scalability"),
163-
])
164-
), // thead
165-
m("tbody",
166-
vnode.state.tables.map(function(o) {
167-
return m("tr",
168-
m("td", o.name),
169-
m("td", o.accessType),
170-
m("td", o.key || "N/A"),
171-
m("td", o.rows),
172-
m("td", "O(" + o.scalability + ")")
173-
)
174-
})
175-
) // tbody
163+
m("table", [
164+
m("tr", [
165+
m("th", "Table"),
166+
m("th", "Access type"),
167+
m("th", "Possible indexes"),
168+
m("th", "Index"),
169+
m("th", "Index key length"),
170+
m("th", "Ref"),
171+
m("th", "Rows examined per scan"),
172+
m("th", "Filtered"),
173+
m("th", "Scalability"),
174+
]),
175+
vnode.state.tables.map(function(o) {
176+
return m("tr",
177+
m("td", o.name),
178+
m("td", o.accessType),
179+
m("td", o.possibleKeys || "N/A"),
180+
m("td", o.key || "N/A"),
181+
m("td", o.keyLength || "N/A"),
182+
m("td", (o.ref || []).join(", ")),
183+
m("td", o.rows),
184+
m("td", o.filtered),
185+
m("td", "O(" + o.scalability + ")")
186+
)
187+
})
176188
]),
177189
m(vnode.state.tablesScalability),
178190
m(vnode.state.commentary)

0 commit comments

Comments
 (0)