Skip to content

Commit

Permalink
Estimate number of launched workers from gather node
Browse files Browse the repository at this point in the history
If the count is not available in the node itself.

Fixes #578
  • Loading branch information
pgiraud committed Oct 10, 2024
1 parent 5e7aaf5 commit a66528d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export enum NodeProp {
AVERAGE_IO_WRITE_TIME = "*I/O Write Speed (exclusive)",

WORKERS_PLANNED_BY_GATHER = "*Workers Planned By Gather",
WORKERS_LAUNCHED_BY_GATHER = "*Workers Launched By Gather",

CTE_SCAN = "CTE Scan",
CTE_NAME = "CTE Name",
Expand Down
3 changes: 3 additions & 0 deletions src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ export default function useNode(
if (node[NodeProp.WORKERS_LAUNCHED]) {
return node[NodeProp.WORKERS_LAUNCHED] as number
}
if (node[NodeProp.WORKERS_LAUNCHED_BY_GATHER]) {
return node[NodeProp.WORKERS_LAUNCHED_BY_GATHER] as number
}
const workers = node[NodeProp.WORKERS] as Worker[]
return workers ? workers.length : NaN
})
Expand Down
3 changes: 3 additions & 0 deletions src/services/plan-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ export class PlanService {
child[NodeProp.WORKERS_PLANNED_BY_GATHER] =
node[NodeProp.WORKERS_PLANNED] ||
node[NodeProp.WORKERS_PLANNED_BY_GATHER]
child[NodeProp.WORKERS_LAUNCHED_BY_GATHER] =
node[NodeProp.WORKERS_LAUNCHED] ||
node[NodeProp.WORKERS_LAUNCHED_BY_GATHER]
}
if (this.isCTE(child)) {
plan.ctes.push(child)
Expand Down

0 comments on commit a66528d

Please sign in to comment.