Skip to content

Commit 7a52c4f

Browse files
authored
Merge pull request #1111 from oskarhane/plan-memory
Add memory allocation to plan output if provided by Neo4j
2 parents bbf53d8 + dc44df2 commit 7a52c4f

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

e2e_tests/integration/plan.spec.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ describe('Plan output', () => {
2929
.should('include', 'Neo4j Browser')
3030
cy.wait(3000)
3131
cy.disableEditorAutocomplete()
32+
const password = Cypress.config('password')
33+
cy.connect('neo4j', password)
3234
})
3335
after(function() {
3436
cy.enableEditorAutocomplete()
3537
})
36-
it('can connect', () => {
37-
const password = Cypress.config('password')
38-
cy.connect('neo4j', password)
39-
})
4038
it('displays the expanded details by default and displays/hides details when clicking the plan expand/collapse buttons respectively', () => {
4139
cy.executeCommand(':clear')
4240
cy.executeCommand(
@@ -69,6 +67,18 @@ describe('Plan output', () => {
6967
el.should('contain', 'Ordered by n.age ASC')
7068
})
7169
}
70+
if (Cypress.config('serverVersion') >= 4.1) {
71+
it('print total memory in PROFILE', () => {
72+
cy.executeCommand(':clear')
73+
cy.executeCommand('CREATE INDEX ON :Person(age)')
74+
cy.executeCommand(
75+
'PROFILE MATCH (n:Person) WHERE n.age > 18 RETURN n.name ORDER BY n.age'
76+
)
77+
cy.get('[data-testid="planExpandButton"]', { timeout: 10000 }).click()
78+
cy.get('.global-memory').should('contain', 'total memory (bytes)')
79+
cy.get('.operator-memory').should('contain', 'memory (bytes)')
80+
})
81+
}
7282
if (
7383
Cypress.config('serverVersion') >= 3.4 &&
7484
Cypress.config('serverVersion') < 4.0 &&

src/browser/modules/D3Visualization/lib/visualization/components/queryPlan.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function queryPlan(element) {
2525
const maxComparableRows = 1000000 // link widths are comparable between plans if all operators are below this row count
2626
const maxComparableDbHits = 1000000 // db hits are comparable between plans if all operators are below this db hit count
2727

28-
const operatorWidth = 180
28+
const operatorWidth = 220
2929
const operatorCornerRadius = 4
3030
const operatorHeaderHeight = 18
3131
const operatorHeaderFontSize = 11
@@ -184,6 +184,20 @@ function queryPlan(element) {
184184
wordWrap(`Ordered by ${operator.Order}`, 'order')
185185
details.push({ className: 'padding' })
186186
}
187+
if (operator.GlobalMemory) {
188+
details.push({
189+
className: 'global-memory',
190+
key: 'total memory (bytes)',
191+
value: formatNumber(operator.GlobalMemory)
192+
})
193+
}
194+
if (operator.Memory) {
195+
details.push({
196+
className: 'operator-memory',
197+
key: 'memory (bytes)',
198+
value: formatNumber(operator.Memory)
199+
})
200+
}
187201

188202
if (operator.PageCacheHits || operator.PageCacheMisses) {
189203
details.push({

0 commit comments

Comments
 (0)