Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add help message for IO Timings in parallel nodes #677

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/components/DiagramRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ViewOptionsKey,
} from "@/symbols"
import type { IPlan, Node, ViewOptions } from "@/interfaces"
import { HelpService } from "@/services/help-service"
import { EstimateDirection, BufferLocation, NodeProp, Metric } from "../enums"
import LevelDivider from "@/components/LevelDivider.vue"
import useNode from "@/node"
Expand Down Expand Up @@ -40,6 +41,9 @@ if (!selectNode) {
}
const highlightedNodeId = inject(HighlightedNodeIdKey)

const helpService = new HelpService()
const getHelpMessage = helpService.getHelpMessage

const viewOptions = inject(ViewOptionsKey) as ViewOptions
const {
buffersByLocationTooltip,
Expand Down Expand Up @@ -74,6 +78,13 @@ function getTooltipContent(node: Node): string {
break
case Metric.io:
content += ioTooltip.value

if (
node[NodeProp.WORKERS_PLANNED] ||
node[NodeProp.WORKERS_PLANNED_BY_GATHER]
) {
content += `<br><small>${getHelpMessage("io timings parallel")}</small>`
}
break
}
if (node[NodeProp.CTE_NAME]) {
Expand Down
12 changes: 12 additions & 0 deletions src/components/PlanNodeDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const activeTab = ref<string>("general")

const helpService = new HelpService()
const getNodeTypeDescription = helpService.getNodeTypeDescription
const getHelpMessage = helpService.getHelpMessage

const {
costClass,
Expand Down Expand Up @@ -336,6 +337,17 @@ watch(activeTab, () => {
<b>Read:&nbsp;</b>
{{ formattedProp("EXCLUSIVE_IO_READ_TIME") }}
<small>~{{ formattedProp("AVERAGE_IO_READ_TIME") }}</small>
<FontAwesomeIcon
:icon="faInfoCircle"
class="cursor-help d-inline-block text-secondary"
v-tippy="{
content: getHelpMessage('io timings parallel'),
}"
v-if="
node[NodeProp.WORKERS_PLANNED] ||
node[NodeProp.WORKERS_PLANNED_BY_GATHER]
"
></FontAwesomeIcon>
</span>
<br />
<span v-if="node[NodeProp.EXCLUSIVE_IO_WRITE_TIME]" class="ms-2">
Expand Down
17 changes: 17 additions & 0 deletions src/components/PlanStats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ function averageIO(node: Node) {
}
return r.join(", ")
}

function hasParallelChildren(node: Node) {
return node.Plans.some(function iter(a) {
if (a[NodeProp.WORKERS_PLANNED] || a[NodeProp.WORKERS_PLANNED_BY_GATHER]) {
return true
}
return Array.isArray(a.Plans) && a.Plans.some(iter)
})
}
</script>

<template>
Expand Down Expand Up @@ -260,6 +269,14 @@ function averageIO(node: Node) {
"
>
IO: <span v-html="averageIO(rootNode)"></span>
<FontAwesomeIcon
:icon="faInfoCircle"
class="cursor-help d-inline-block text-secondary"
v-tippy="{
content: getHelpMessage('io timings parallel'),
}"
v-if="hasParallelChildren(rootNode)"
></FontAwesomeIcon>
</div>
</div>
</template>
1 change: 1 addition & 0 deletions src/services/help-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Consider modifying max_parallel_workers or max_parallel_workers_per_gather.`,
"WORKERS DETAILED INFO MISSING": `Consider using EXPLAIN (ANALYZE, VERBOSE)`,
"FUZZY NEEDS VERBOSE": `Information may not be accurate. Use EXPLAIN VERBOSE mode.`,
"HINT TRACK_IO_TIMING": `HINT: activate <em><b>track_io_timing</b></em> to have details on time spent outside the PG cache.`,
"IO TIMINGS PARALLEL": "Distributed among parallel workers",
}

interface EaseInOutQuadOptions {
Expand Down
Loading