@culpritsql/plan-viewer 0.0.0-stage → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +205 -2
- package/package.json +57 -4
- package/pkg/ActualSummary.d.ts +10 -0
- package/pkg/ActualSummary.js +72 -0
- package/pkg/DeadlockGraph.d.ts +9 -0
- package/pkg/DeadlockGraph.js +135 -0
- package/pkg/DeadlockViewer.d.ts +20 -0
- package/pkg/DeadlockViewer.js +62 -0
- package/pkg/DocdbWork.d.ts +7 -0
- package/pkg/DocdbWork.js +37 -0
- package/pkg/NodeDetails.d.ts +15 -0
- package/pkg/NodeDetails.js +161 -0
- package/pkg/OpIcon.d.ts +9 -0
- package/pkg/OpIcon.js +54 -0
- package/pkg/PlanAssessmentNotes.d.ts +3 -0
- package/pkg/PlanAssessmentNotes.js +8 -0
- package/pkg/PlanCanvas.d.ts +47 -0
- package/pkg/PlanCanvas.js +9 -0
- package/pkg/PlanDiagram.d.ts +47 -0
- package/pkg/PlanDiagram.js +534 -0
- package/pkg/PlanDiffViewer.d.ts +31 -0
- package/pkg/PlanDiffViewer.js +317 -0
- package/pkg/PlanInsights.d.ts +6 -0
- package/pkg/PlanInsights.js +100 -0
- package/pkg/PlanObjects.d.ts +7 -0
- package/pkg/PlanObjects.js +138 -0
- package/pkg/PlanOperations.d.ts +8 -0
- package/pkg/PlanOperations.js +114 -0
- package/pkg/PlanRaw.d.ts +4 -0
- package/pkg/PlanRaw.js +35 -0
- package/pkg/PlanSurface.d.ts +21 -0
- package/pkg/PlanSurface.js +66 -0
- package/pkg/PlanTypeSchema.d.ts +5 -0
- package/pkg/PlanTypeSchema.js +62 -0
- package/pkg/PlanView.d.ts +27 -0
- package/pkg/PlanView.js +160 -0
- package/pkg/PlanViewer.d.ts +30 -0
- package/pkg/PlanViewer.js +19 -0
- package/pkg/Prose.d.ts +4 -0
- package/pkg/Prose.js +6 -0
- package/pkg/Sql.d.ts +5 -0
- package/pkg/Sql.js +7 -0
- package/pkg/THIRD-PARTY-LICENSES.txt +9021 -0
- package/pkg/build-report.json +907 -0
- package/pkg/defaults.d.ts +29 -0
- package/pkg/defaults.js +438 -0
- package/pkg/host.d.ts +118 -0
- package/pkg/host.js +593 -0
- package/pkg/index.d.ts +22 -0
- package/pkg/index.js +21 -0
- package/pkg/models/Ability.d.ts +6 -0
- package/pkg/models/ActualSummary.d.ts +16 -0
- package/pkg/models/CachedStatementContext.d.ts +9 -0
- package/pkg/models/CachedStatementIdentity.d.ts +7 -0
- package/pkg/models/ChangeKind.d.ts +3 -0
- package/pkg/models/CleanupEvidence.d.ts +6 -0
- package/pkg/models/CollectionTarget.d.ts +5 -0
- package/pkg/models/CompilationMemory.d.ts +3 -0
- package/pkg/models/CompileHistory.d.ts +13 -0
- package/pkg/models/Connect.d.ts +22 -0
- package/pkg/models/ConnectionSecurityMode.d.ts +3 -0
- package/pkg/models/ConnectionSecuritySpec.d.ts +4 -0
- package/pkg/models/ConstraintValidation.d.ts +6 -0
- package/pkg/models/DatabaseIdentity.d.ts +5 -0
- package/pkg/models/DatabaseLocation.d.ts +3 -0
- package/pkg/models/DatabaseProduct.d.ts +6 -0
- package/pkg/models/Deadlock.d.ts +23 -0
- package/pkg/models/DeadlockFix.d.ts +16 -0
- package/pkg/models/DeadlockFixKind.d.ts +6 -0
- package/pkg/models/DeadlockPattern.d.ts +3 -0
- package/pkg/models/DeadlockProcess.d.ts +23 -0
- package/pkg/models/DeadlockResource.d.ts +12 -0
- package/pkg/models/DistributionPopulation.d.ts +3 -0
- package/pkg/models/DocdbMetrics.d.ts +7 -0
- package/pkg/models/Engine.d.ts +3 -0
- package/pkg/models/EngineAbilities.d.ts +46 -0
- package/pkg/models/EngineFacts.d.ts +28 -0
- package/pkg/models/EvidencePresentation.d.ts +4 -0
- package/pkg/models/ExecutionProtection.d.ts +3 -0
- package/pkg/models/Guess.d.ts +6 -0
- package/pkg/models/InsightArea.d.ts +6 -0
- package/pkg/models/LocalizedText.d.ts +4 -0
- package/pkg/models/LockHolder.d.ts +3 -0
- package/pkg/models/LogRateGovernanceReason.d.ts +7 -0
- package/pkg/models/Message.d.ts +4 -0
- package/pkg/models/MessageValue.d.ts +4 -0
- package/pkg/models/Metric.d.ts +10 -0
- package/pkg/models/MssqlCatalogIndexColumn.d.ts +3 -0
- package/pkg/models/MssqlCurrentTableType.d.ts +10 -0
- package/pkg/models/MssqlCurrentTypeColumn.d.ts +7 -0
- package/pkg/models/MssqlCurrentTypeIndex.d.ts +4 -0
- package/pkg/models/MssqlCurrentTypeModule.d.ts +4 -0
- package/pkg/models/MssqlCurrentTypeParameter.d.ts +3 -0
- package/pkg/models/MssqlCurrentTypeSchema.d.ts +11 -0
- package/pkg/models/MssqlCurrentTypeSchemaStatus.d.ts +3 -0
- package/pkg/models/MssqlIndexParentKind.d.ts +3 -0
- package/pkg/models/MssqlObjectIdentity.d.ts +7 -0
- package/pkg/models/NativeIdentity.d.ts +3 -0
- package/pkg/models/NativePlanIdentity.d.ts +4 -0
- package/pkg/models/NativeQueryIdentity.d.ts +3 -0
- package/pkg/models/NativeReadContext.d.ts +13 -0
- package/pkg/models/NodeKind.d.ts +3 -0
- package/pkg/models/NodeMatch.d.ts +3 -0
- package/pkg/models/NodeRuntime.d.ts +28 -0
- package/pkg/models/PageServerReadAvailability.d.ts +3 -0
- package/pkg/models/PageServerReadStatistics.d.ts +8 -0
- package/pkg/models/PageServerReadSummary.d.ts +19 -0
- package/pkg/models/PartitionTail.d.ts +6 -0
- package/pkg/models/Plan.d.ts +11 -0
- package/pkg/models/PlanAccessRows.d.ts +13 -0
- package/pkg/models/PlanAutomaticIndex.d.ts +3 -0
- package/pkg/models/PlanChange.d.ts +17 -0
- package/pkg/models/PlanChangedColumn.d.ts +3 -0
- package/pkg/models/PlanConversion.d.ts +4 -0
- package/pkg/models/PlanConversionIssue.d.ts +3 -0
- package/pkg/models/PlanCurrentTypeSchemaView.d.ts +6 -0
- package/pkg/models/PlanDiff.d.ts +13 -0
- package/pkg/models/PlanExecutionMode.d.ts +3 -0
- package/pkg/models/PlanFacts.d.ts +36 -0
- package/pkg/models/PlanHistory.d.ts +6 -0
- package/pkg/models/PlanHistoryKind.d.ts +3 -0
- package/pkg/models/PlanIndexColumns.d.ts +3 -0
- package/pkg/models/PlanIndexHint.d.ts +3 -0
- package/pkg/models/PlanInsight.d.ts +44 -0
- package/pkg/models/PlanInsightShare.d.ts +3 -0
- package/pkg/models/PlanInsights.d.ts +8 -0
- package/pkg/models/PlanKind.d.ts +3 -0
- package/pkg/models/PlanMeasurementRef.d.ts +3 -0
- package/pkg/models/PlanMemoryGrantFeedback.d.ts +15 -0
- package/pkg/models/PlanMemoryGrantFeedbackIssue.d.ts +3 -0
- package/pkg/models/PlanMemoryGrantFeedbackState.d.ts +3 -0
- package/pkg/models/PlanNode.d.ts +7 -0
- package/pkg/models/PlanNodeFacts.d.ts +63 -0
- package/pkg/models/PlanOperatorView.d.ts +5 -0
- package/pkg/models/PlanPageServerIo.d.ts +16 -0
- package/pkg/models/PlanPageServerIoIssue.d.ts +4 -0
- package/pkg/models/PlanPageServerIoView.d.ts +7 -0
- package/pkg/models/PlanPageServerMetric.d.ts +3 -0
- package/pkg/models/PlanParameter.d.ts +10 -0
- package/pkg/models/PlanParameterComparison.d.ts +3 -0
- package/pkg/models/PlanParameterContext.d.ts +15 -0
- package/pkg/models/PlanParameterIssue.d.ts +3 -0
- package/pkg/models/PlanParameterUse.d.ts +4 -0
- package/pkg/models/PlanParameterUseKind.d.ts +3 -0
- package/pkg/models/PlanParameterValueState.d.ts +3 -0
- package/pkg/models/PlanParentRelationship.d.ts +3 -0
- package/pkg/models/PlanRegion.d.ts +7 -0
- package/pkg/models/PlanSampleSource.d.ts +6 -0
- package/pkg/models/PlanScanCompletion.d.ts +8 -0
- package/pkg/models/PlanScanThread.d.ts +3 -0
- package/pkg/models/PlanTemporaryTableUse.d.ts +7 -0
- package/pkg/models/PlanVariant.d.ts +23 -0
- package/pkg/models/PlanView.d.ts +9 -0
- package/pkg/models/PlanWarning.d.ts +3 -0
- package/pkg/models/PlanningStep.d.ts +7 -0
- package/pkg/models/ProductFacts.d.ts +11 -0
- package/pkg/models/QueryCosts.d.ts +62 -0
- package/pkg/models/QueryStat.d.ts +69 -0
- package/pkg/models/QueryTrend.d.ts +7 -0
- package/pkg/models/QueryVariantFamily.d.ts +9 -0
- package/pkg/models/QueryWaitCoverage.d.ts +8 -0
- package/pkg/models/ReadUnit.d.ts +7 -0
- package/pkg/models/Refusal.d.ts +7 -0
- package/pkg/models/RelationalInput.d.ts +5 -0
- package/pkg/models/RelationalInputKind.d.ts +3 -0
- package/pkg/models/RelationalInputProvenance.d.ts +3 -0
- package/pkg/models/RequestEvidence.d.ts +7 -0
- package/pkg/models/RetainedPlanProvenance.d.ts +11 -0
- package/pkg/models/RuntimeDistribution.d.ts +16 -0
- package/pkg/models/RuntimeDistributionIssue.d.ts +3 -0
- package/pkg/models/RuntimeDistributionOrigin.d.ts +3 -0
- package/pkg/models/RuntimeDuration.d.ts +3 -0
- package/pkg/models/RuntimeHistogramBucket.d.ts +8 -0
- package/pkg/models/RuntimeQuantile.d.ts +4 -0
- package/pkg/models/Scenario.d.ts +11 -0
- package/pkg/models/ScenarioKind.d.ts +3 -0
- package/pkg/models/SessionAction.d.ts +6 -0
- package/pkg/models/SessionIdFormat.d.ts +6 -0
- package/pkg/models/Severity.d.ts +3 -0
- package/pkg/models/SharedResourceIdentity.d.ts +11 -0
- package/pkg/models/SharedResourceKind.d.ts +3 -0
- package/pkg/models/SourcePartition.d.ts +8 -0
- package/pkg/models/Spread.d.ts +18 -0
- package/pkg/models/SqlSyntax.d.ts +6 -0
- package/pkg/models/StatementMetrics.d.ts +32 -0
- package/pkg/models/StatementOrigin.d.ts +6 -0
- package/pkg/models/StatementTemporaryWork.d.ts +3 -0
- package/pkg/models/StatisticsFreshness.d.ts +3 -0
- package/pkg/models/TriggerTiming.d.ts +3 -0
- package/pkg/models/Unit.d.ts +3 -0
- package/pkg/models/WaitClass.d.ts +3 -0
- package/pkg/models/WaitMechanism.d.ts +4 -0
- package/pkg/models/WaitSampling.d.ts +3 -0
- package/pkg/models/WaitStat.d.ts +4 -0
- package/pkg/models/WorkerSkew.d.ts +3 -0
- package/pkg/models/WriteLog.d.ts +7 -0
- package/pkg/models/WriteRows.d.ts +7 -0
- package/pkg/styles.css +3273 -0
- package/pkg/types.d.ts +29 -0
- package/pkg/types.js +1 -0
package/pkg/DocdbWork.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { count, duration, t } from "./host.js";
|
|
3
|
+
/** Native storage entries and RPCs retain their units; they are never PostgreSQL pages or CPU utilization. */
|
|
4
|
+
export function DocdbWork({ metrics, basis, runs }) {
|
|
5
|
+
if (!metrics)
|
|
6
|
+
return null;
|
|
7
|
+
const divisor = basis === "workload" && runs != null && runs > 0 ? runs : 1;
|
|
8
|
+
const said = basis === "workload" ? (runs != null && runs > 0 ? "per_run" : "retained") : basis === "loop" ? "per_loop" : "execution";
|
|
9
|
+
const entries = [
|
|
10
|
+
["read_requests", t("ui.docdb_work.read_requests"), "count"],
|
|
11
|
+
["write_requests", t("ui.docdb_work.write_requests"), "count"],
|
|
12
|
+
["read_operations", t("ui.docdb_work.read_operations"), "count"],
|
|
13
|
+
["write_operations", t("ui.docdb_work.write_operations"), "count"],
|
|
14
|
+
["rows_scanned", t("ui.docdb_work.rows_scanned"), "count"],
|
|
15
|
+
["rows_returned", t("ui.docdb_work.rows_returned"), "count"],
|
|
16
|
+
["read_ms", t("ui.docdb_work.read_ms"), "time"],
|
|
17
|
+
["write_ms", t("ui.docdb_work.write_ms"), "time"],
|
|
18
|
+
["wait_ms", t("ui.docdb_work.wait_ms"), "time"],
|
|
19
|
+
["catalog_ms", t("ui.docdb_work.catalog_ms"), "time"],
|
|
20
|
+
["retries", t("ui.docdb_work.retries"), "count"],
|
|
21
|
+
["conflict_retries", t("ui.docdb_work.conflict_retries"), "count"],
|
|
22
|
+
["read_restarts", t("ui.docdb_work.read_restarts"), "count"],
|
|
23
|
+
["obsolete_rows_scanned", t("ui.docdb_work.obsolete_rows_scanned"), "count"],
|
|
24
|
+
["seeks", t("ui.docdb_work.seeks"), "count"],
|
|
25
|
+
["nexts", t("ui.docdb_work.nexts"), "count"],
|
|
26
|
+
["prevs", t("ui.docdb_work.prevs"), "count"],
|
|
27
|
+
];
|
|
28
|
+
const rows = entries.flatMap(([key, title, unit]) => {
|
|
29
|
+
const value = metrics[key];
|
|
30
|
+
return value == null || !Number.isFinite(value) || value < 0
|
|
31
|
+
? []
|
|
32
|
+
: [{ key, title, value: unit === "time" ? duration(value / divisor) : count(value / divisor) }];
|
|
33
|
+
});
|
|
34
|
+
if (rows.length === 0)
|
|
35
|
+
return null;
|
|
36
|
+
return (_jsxs("section", { className: "beyond", "aria-label": t("ui.docdb_work.title"), children: [_jsx("h3", { children: t("ui.docdb_work.title") }), _jsx("p", { className: "beyond-foot", children: t("ui.docdb_work.foot", { basis: said }) }), _jsx("div", { className: "beyond-rows", role: "list", children: rows.map((row) => (_jsxs("div", { className: "beyond-row", role: "listitem", children: [_jsx("i", { className: "sig-dot info", "aria-hidden": true }), _jsx("span", { className: "beyond-label", children: row.title }), _jsx("span", { className: "beyond-value", children: row.value })] }, row.key))) })] }));
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PlanViewerTheme } from "./PlanViewer.js";
|
|
2
|
+
import type { Plan, PlanInsight, PlanNode } from "./types.js";
|
|
3
|
+
/** One operator, explained: what it does, its rows, cost, buffers/I/O, parallelism, warnings, then raw properties on demand. */
|
|
4
|
+
export declare function NodeDetails({ plan, node, share, subtreeShare, noShare, insights, estimates, actual, theme, className, }: {
|
|
5
|
+
plan?: Plan;
|
|
6
|
+
node: PlanNode;
|
|
7
|
+
share: number | null;
|
|
8
|
+
subtreeShare?: number | null;
|
|
9
|
+
noShare?: string | null;
|
|
10
|
+
insights?: PlanInsight[];
|
|
11
|
+
estimates?: boolean;
|
|
12
|
+
actual?: boolean;
|
|
13
|
+
theme?: PlanViewerTheme;
|
|
14
|
+
className?: string;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRight, Search, TriangleAlert } from "lucide-react";
|
|
3
|
+
import { Fragment, useMemo, useState } from "react";
|
|
4
|
+
import { DocdbWork } from "./DocdbWork.js";
|
|
5
|
+
import { cost, count, duration, estRowsForRuns, exact, misestimate, operatorRuns, operatorView, percent, propValue, shortPredicate, t } from "./host.js";
|
|
6
|
+
import { OpIcon } from "./OpIcon.js";
|
|
7
|
+
function warningLabel(warning) {
|
|
8
|
+
switch (warning) {
|
|
9
|
+
case "implicit-conversion":
|
|
10
|
+
return t("ui.node_details.warning.implicit_conversion");
|
|
11
|
+
case "spill":
|
|
12
|
+
return t("ui.node_details.warning.spill");
|
|
13
|
+
case "no-join-predicate":
|
|
14
|
+
return t("ui.node_details.warning.no_join_predicate");
|
|
15
|
+
case "missing-statistics":
|
|
16
|
+
return t("ui.node_details.warning.missing_statistics");
|
|
17
|
+
case "memory-grant":
|
|
18
|
+
return t("ui.node_details.warning.memory_grant");
|
|
19
|
+
case "misestimate":
|
|
20
|
+
return t("ui.node_details.warning.misestimate");
|
|
21
|
+
case "residual-predicate":
|
|
22
|
+
return t("ui.node_details.warning.residual_predicate");
|
|
23
|
+
default:
|
|
24
|
+
return warning;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const SHOWN = new Set([
|
|
28
|
+
"PhysicalOp",
|
|
29
|
+
"LogicalOp",
|
|
30
|
+
"EstimateRows",
|
|
31
|
+
"EstimatedRowsRead",
|
|
32
|
+
"TableCardinality",
|
|
33
|
+
"EstimatedTotalSubtreeCost",
|
|
34
|
+
"EstimateCPU",
|
|
35
|
+
"EstimateIO",
|
|
36
|
+
"ActualRows",
|
|
37
|
+
"ActualExecutions",
|
|
38
|
+
"ActualRowsRead",
|
|
39
|
+
"ActualLogicalReads",
|
|
40
|
+
"ActualPhysicalReads",
|
|
41
|
+
"ActualExecutionMode",
|
|
42
|
+
"EstimateRebinds",
|
|
43
|
+
"EstimateRewinds",
|
|
44
|
+
"OutputList",
|
|
45
|
+
"Rows Removed by Filter",
|
|
46
|
+
"Parent Relationship",
|
|
47
|
+
"Shared Hit Blocks",
|
|
48
|
+
"Shared Read Blocks",
|
|
49
|
+
"Shared Dirtied Blocks",
|
|
50
|
+
"Shared Written Blocks",
|
|
51
|
+
"Local Hit Blocks",
|
|
52
|
+
"Local Read Blocks",
|
|
53
|
+
"Temp Read Blocks",
|
|
54
|
+
"Temp Written Blocks",
|
|
55
|
+
"I/O Read Time",
|
|
56
|
+
"I/O Write Time",
|
|
57
|
+
"WAL Bytes",
|
|
58
|
+
"WAL Records",
|
|
59
|
+
"Workers Planned",
|
|
60
|
+
"Workers Launched",
|
|
61
|
+
"Sort Space Used",
|
|
62
|
+
]);
|
|
63
|
+
const MAX_PAGE_SERVER_METRICS = 4;
|
|
64
|
+
const MAX_PAGE_SERVER_LIMITATIONS = 2;
|
|
65
|
+
function formatKb(kb) {
|
|
66
|
+
if (kb >= 1024 * 1024)
|
|
67
|
+
return `${(kb / 1024 / 1024).toFixed(1)}\u00a0GB`;
|
|
68
|
+
if (kb >= 1024)
|
|
69
|
+
return `${(kb / 1024).toFixed(kb >= 10 * 1024 ? 0 : 1)}\u00a0MB`;
|
|
70
|
+
return `${Math.round(kb)}\u00a0KB`;
|
|
71
|
+
}
|
|
72
|
+
function formatBytes(bytes) {
|
|
73
|
+
if (bytes >= 1024 * 1024 * 1024)
|
|
74
|
+
return `${(bytes / 1024 / 1024 / 1024).toFixed(1)}\u00a0GB`;
|
|
75
|
+
if (bytes >= 1024 * 1024)
|
|
76
|
+
return `${(bytes / 1024 / 1024).toFixed(1)}\u00a0MB`;
|
|
77
|
+
if (bytes >= 1024)
|
|
78
|
+
return `${(bytes / 1024).toFixed(1)}\u00a0KB`;
|
|
79
|
+
return `${Math.round(bytes)}\u00a0B`;
|
|
80
|
+
}
|
|
81
|
+
function uses8KbPages(engine) {
|
|
82
|
+
return engine === "postgres" || engine === "mssql" || engine === "yugabyte";
|
|
83
|
+
}
|
|
84
|
+
function formatPages(pages, engine) {
|
|
85
|
+
const base = exact(pages);
|
|
86
|
+
if (!uses8KbPages(engine) || pages <= 0)
|
|
87
|
+
return base;
|
|
88
|
+
return `${base} (${formatKb(pages * 8)})`;
|
|
89
|
+
}
|
|
90
|
+
function optNumber(raw) {
|
|
91
|
+
if (raw == null || raw.trim() === "")
|
|
92
|
+
return null;
|
|
93
|
+
const n = Number(raw);
|
|
94
|
+
return Number.isFinite(n) && n > 0 ? n : null;
|
|
95
|
+
}
|
|
96
|
+
function PageServerIoDetails({ view }) {
|
|
97
|
+
return (_jsxs("details", { className: "nd-all nd-page-server", children: [_jsxs("summary", { children: [_jsx(ChevronRight, { size: 13, className: "chev", "aria-hidden": "true" }), " ", t("view.plan_page_server_io.title")] }), _jsxs("div", { className: "nd-card nd-page-server-body", children: [_jsx("dl", { children: view.metrics.slice(0, MAX_PAGE_SERVER_METRICS).map((metric) => (_jsxs(Fragment, { children: [_jsx("dt", { children: metric.label }), _jsx("dd", { children: metric.text ?? t("view.plan_page_server_io.unknown") })] }, metric.key || metric.label))) }), view.limitations.slice(0, MAX_PAGE_SERVER_LIMITATIONS).map((limitation) => (_jsx("p", { className: "nd-page-server-limit muted", children: limitation }, limitation)))] })] }));
|
|
98
|
+
}
|
|
99
|
+
function ratio(plan, n) {
|
|
100
|
+
const factor = misestimate(plan, n);
|
|
101
|
+
if (factor == null || Math.abs(factor) < 2)
|
|
102
|
+
return null;
|
|
103
|
+
return (_jsx("span", { className: `nd-ratio ${n.warnings.includes("misestimate") ? "bad" : ""}`, children: factor > 0
|
|
104
|
+
? t("ui.node_details.more_than_expected", { factor: exact(Math.round(Math.abs(factor))) })
|
|
105
|
+
: t("ui.node_details.fewer_than_expected", { factor: exact(Math.round(Math.abs(factor))) }) }));
|
|
106
|
+
}
|
|
107
|
+
/** One operator, explained: what it does, its rows, cost, buffers/I/O, parallelism, warnings, then raw properties on demand. */
|
|
108
|
+
export function NodeDetails({ plan, node, share, subtreeShare, noShare, insights = [], estimates = true, actual = false, theme, className, }) {
|
|
109
|
+
const [filter, setFilter] = useState("");
|
|
110
|
+
const props = useMemo(() => {
|
|
111
|
+
const q = filter.trim().toLowerCase();
|
|
112
|
+
return Object.entries(node.props)
|
|
113
|
+
.filter(([k, v]) => v != null && v !== "" && !SHOWN.has(k))
|
|
114
|
+
.filter(([k, v]) => !q || k.toLowerCase().includes(q) || v.toLowerCase().includes(q))
|
|
115
|
+
.sort(([a], [b]) => a.localeCompare(b));
|
|
116
|
+
}, [node, filter]);
|
|
117
|
+
const cpu = Number(node.props.EstimateCPU ?? NaN);
|
|
118
|
+
const io = Number(node.props.EstimateIO ?? NaN);
|
|
119
|
+
const split = Number.isFinite(cpu) && Number.isFinite(io) && cpu + io > 0 ? cpu / (cpu + io) : null;
|
|
120
|
+
const removed = node.props["Rows Removed by Filter"];
|
|
121
|
+
const executions = operatorRuns(plan, node) ?? 0;
|
|
122
|
+
const pageServerIo = operatorView(plan, node)?.page_server_io;
|
|
123
|
+
const rt = node.runtime;
|
|
124
|
+
const logicalReads = rt?.logical_reads ?? null;
|
|
125
|
+
const physicalReads = rt?.physical_reads ?? null;
|
|
126
|
+
const cachedReads = logicalReads != null && physicalReads != null ? Math.max(0, logicalReads - physicalReads) : null;
|
|
127
|
+
const hitShare = logicalReads != null && logicalReads > 0 && cachedReads != null ? cachedReads / logicalReads : null;
|
|
128
|
+
const spillPages = rt?.spill_pages != null && rt.spill_pages > 0 ? rt.spill_pages : null;
|
|
129
|
+
const cpuMs = rt?.cpu_ms ?? null;
|
|
130
|
+
const heapFetches = node.facts.heap_fetches != null && node.facts.heap_fetches > 0 ? node.facts.heap_fetches : null;
|
|
131
|
+
const sortSpaceKb = node.facts.sort_space_kb != null && node.facts.sort_space_kb > 0 ? node.facts.sort_space_kb : null;
|
|
132
|
+
const diskUsageKb = node.facts.disk_usage_kb != null && node.facts.disk_usage_kb > 0 ? node.facts.disk_usage_kb : null;
|
|
133
|
+
const ioReadMs = optNumber(node.props["I/O Read Time"]);
|
|
134
|
+
const ioWriteMs = optNumber(node.props["I/O Write Time"]);
|
|
135
|
+
const walBytes = optNumber(node.props["WAL Bytes"]);
|
|
136
|
+
const execMode = node.facts.actual_execution_mode ?? null;
|
|
137
|
+
const hasIoCard = logicalReads != null ||
|
|
138
|
+
physicalReads != null ||
|
|
139
|
+
spillPages != null ||
|
|
140
|
+
cpuMs != null ||
|
|
141
|
+
heapFetches != null ||
|
|
142
|
+
sortSpaceKb != null ||
|
|
143
|
+
diskUsageKb != null ||
|
|
144
|
+
ioReadMs != null ||
|
|
145
|
+
ioWriteMs != null ||
|
|
146
|
+
walBytes != null ||
|
|
147
|
+
execMode != null;
|
|
148
|
+
const workersPlanned = node.facts.workers_planned ?? null;
|
|
149
|
+
const workersLaunched = node.facts.workers_launched ?? null;
|
|
150
|
+
const threadRows = rt?.thread_rows ?? [];
|
|
151
|
+
const maxWorkerRows = threadRows.length > 0 ? Math.max(1, ...threadRows) : 1;
|
|
152
|
+
const hasParallelCard = workersPlanned != null || workersLaunched != null || threadRows.length > 1;
|
|
153
|
+
return (_jsxs("div", { className: `culprit-pv nd ${className ?? ""}`, "data-theme": theme && theme !== "system" ? theme : undefined, children: [_jsxs("div", { className: "nd-head", children: [_jsx("span", { className: "nd-icon", children: _jsx(OpIcon, { node: node, size: 16 }) }), _jsxs("div", { className: "nd-title", children: [_jsxs("div", { className: "nd-op", children: [node.op, node.detail && _jsx("span", { className: "nd-detail", children: node.detail })] }), (node.object || node.index) && (_jsxs("div", { className: "nd-obj mono", children: [node.object, node.index && _jsxs("span", { className: "muted", children: [" \u00B7 ", node.index] })] }))] }), estimates &&
|
|
154
|
+
(share != null ? (_jsxs("span", { className: "nd-share", title: t("ui.node_details.share_hint"), children: [percent(share), _jsxs("span", { className: "muted", children: [" ", t("ui.node_details.of_the_work")] })] })) : (_jsx("span", { className: "nd-share muted", title: noShare ?? undefined, children: t("ui.node_details.no_share_of_work") })))] }), insights.length > 0 && (_jsx("ul", { className: "nd-insights", children: insights.map((i) => (_jsxs("li", { className: i.severity, children: [_jsx("i", {}), i.title] }, i.rule))) })), _jsx(DocdbWork, { metrics: node.facts.docdb, basis: "loop" }), _jsxs("div", { className: "nd-grid", children: [(node.seek_predicate || node.predicate) && (_jsxs("section", { className: "nd-card wide", children: [_jsx("h4", { children: t("ui.node_details.what_it_does") }), node.seek_predicate && (_jsxs("div", { className: "nd-cond", children: [_jsx("span", { className: "nd-k", children: node.kind === "seek" || node.kind === "lookup" ? t("ui.node_details.seeks_on") : t("ui.node_details.index_condition") }), _jsx("code", { children: shortPredicate(node.seek_predicate) })] })), node.predicate && (_jsxs("div", { className: "nd-cond", children: [_jsx("span", { className: "nd-k", children: t("ui.node_details.then_filters") }), _jsx("code", { children: shortPredicate(node.predicate) })] }))] })), estimates && (_jsxs("section", { className: "nd-card", children: [_jsx("h4", { children: t("ui.node_details.rows") }), _jsxs("dl", { children: [_jsx("dt", { children: t("ui.node_details.estimated") }), _jsx("dd", { title: node.act_executions != null ? t("ui.node_details.estimated_hint") : undefined, children: exact(estRowsForRuns(plan, node)) }), node.act_rows != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.actual") }), _jsxs("dd", { children: [exact(node.act_rows), " ", ratio(plan, node)] })] })), executions > 1 && (_jsxs(_Fragment, { children: [_jsx("dt", { children: node.act_executions != null ? t("ui.node_details.ran") : t("ui.node_details.expected_runs") }), _jsx("dd", { children: t("ui.node_details.times", { n: executions, count: exact(executions) }) })] })), node.rows_read != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: actual ? t("ui.node_details.read") : t("ui.node_details.expected_to_read") }), _jsx("dd", { children: exact(node.rows_read) })] })), removed && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.filtered_out") }), _jsx("dd", { children: propValue(removed) })] })), node.table_rows != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.in_table") }), _jsx("dd", { children: exact(node.table_rows) })] }))] })] })), estimates && (_jsxs("section", { className: "nd-card", children: [_jsx("h4", { children: t("ui.node_details.cost") }), _jsxs("dl", { children: [_jsx("dt", { children: t("ui.node_details.this_operator") }), _jsxs("dd", { children: [share != null ? percent(share) : t("ui.node_details.no_share"), " ", _jsxs("span", { className: "muted", children: ["\u00B7 ", plan?.facts.estimated_cost_unavailable ? t("ui.node_details.cost_unavailable") : t("ui.node_details.units", { cost: cost(node.self_cost) })] })] }), subtreeShare != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.with_inputs") }), _jsx("dd", { children: percent(subtreeShare) })] })), node.act_time_ms != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.actual_time") }), _jsx("dd", { children: duration(node.act_time_ms) })] }))] }), share == null && noShare && _jsx("p", { className: "muted", style: { margin: "6px 0 0", fontSize: 12 }, children: noShare }), split != null && (_jsxs("div", { className: "nd-split", title: t("ui.node_details.split_hint", { cpu: percent(split), io: percent(1 - split) }), children: [_jsxs("div", { className: "nd-split-bar", children: [_jsx("span", { className: "cpu", style: { width: `${split * 100}%` } }), _jsx("span", { className: "io", style: { width: `${(1 - split) * 100}%` } })] }), _jsxs("div", { className: "nd-split-legend", children: [_jsxs("span", { children: [_jsx("i", { className: "cpu" }), t("ui.node_details.cpu_share", { share: percent(split) })] }), _jsxs("span", { children: [_jsx("i", { className: "io" }), t("ui.node_details.io_share", { share: percent(1 - split) })] })] })] }))] })), hasIoCard && (_jsxs("section", { className: "nd-card", children: [_jsx("h4", { children: t("ui.node_details.io_buffers") }), _jsxs("dl", { children: [logicalReads != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.logical_reads") }), _jsx("dd", { children: formatPages(logicalReads, plan?.engine) })] })), cachedReads != null && cachedReads > 0 && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.from_cache") }), _jsx("dd", { children: formatPages(cachedReads, plan?.engine) })] })), physicalReads != null && physicalReads > 0 && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.from_disk") }), _jsx("dd", { children: formatPages(physicalReads, plan?.engine) })] })), spillPages != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.spill_pages") }), _jsx("dd", { children: _jsx("span", { className: "nd-ratio bad", children: formatPages(spillPages, plan?.engine) }) })] })), sortSpaceKb != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.sort_memory") }), _jsx("dd", { children: formatKb(sortSpaceKb) })] })), diskUsageKb != null && sortSpaceKb == null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.work_memory") }), _jsx("dd", { children: formatKb(diskUsageKb) })] })), heapFetches != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.heap_fetches") }), _jsx("dd", { children: exact(heapFetches) })] })), cpuMs != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.cpu_time") }), _jsx("dd", { children: duration(cpuMs) })] })), ioReadMs != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.io_read_time") }), _jsx("dd", { children: duration(ioReadMs) })] })), ioWriteMs != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.io_write_time") }), _jsx("dd", { children: duration(ioWriteMs) })] })), walBytes != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.wal_bytes") }), _jsx("dd", { children: formatBytes(walBytes) })] })), execMode != null && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.execution_mode") }), _jsx("dd", { children: execMode.kind === "batch"
|
|
155
|
+
? t("ui.node_details.mode_batch")
|
|
156
|
+
: execMode.kind === "row"
|
|
157
|
+
? t("ui.node_details.mode_row")
|
|
158
|
+
: execMode.value })] }))] }), hitShare != null && (_jsxs("div", { className: "nd-split", children: [_jsxs("div", { className: "nd-split-bar", children: [_jsx("span", { className: "hit", style: { width: `${hitShare * 100}%` } }), _jsx("span", { className: "disk", style: { width: `${(1 - hitShare) * 100}%` } })] }), _jsxs("div", { className: "nd-split-legend", children: [_jsxs("span", { children: [_jsx("i", { className: "hit" }), t("ui.node_details.cache_hit_share", { share: percent(hitShare) })] }), _jsxs("span", { children: [_jsx("i", { className: "disk" }), t("ui.node_details.disk_read_share", { share: percent(1 - hitShare) })] })] })] }))] })), hasParallelCard && (_jsxs("section", { className: "nd-card", children: [_jsx("h4", { children: t("ui.node_details.parallelism") }), _jsx("dl", { children: (workersLaunched != null || workersPlanned != null) && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t("ui.node_details.workers_launched") }), _jsx("dd", { children: workersLaunched != null && workersPlanned != null
|
|
159
|
+
? t("ui.node_details.workers_of_planned", { launched: String(workersLaunched), planned: String(workersPlanned) })
|
|
160
|
+
: String(workersLaunched ?? workersPlanned) })] })) }), threadRows.length > 1 && (_jsx("div", { className: "nd-workers", children: threadRows.slice(0, 8).map((wRows, idx) => (_jsxs("div", { className: "nd-worker-row", children: [_jsx("span", { className: "muted", children: t("ui.node_details.worker_rows", { worker: String(idx + 1) }) }), _jsx("span", { className: "nd-worker-bar", children: _jsx("span", { style: { width: `${Math.max(3, (wRows / maxWorkerRows) * 100)}%` } }) }), _jsx("span", { className: "num", children: count(wRows) })] }, idx))) }))] })), node.warnings.length > 0 && (_jsxs("section", { className: "nd-card nd-warn", children: [_jsxs("h4", { children: [_jsx(TriangleAlert, { size: 12 }), " ", t("ui.node_details.warnings")] }), _jsx("ul", { children: node.warnings.map((w) => (_jsx("li", { children: warningLabel(w) }, w))) })] }))] }), pageServerIo && _jsx(PageServerIoDetails, { view: pageServerIo }, node.id), Object.keys(node.props).length > 0 && (_jsxs("details", { className: "nd-all", children: [_jsxs("summary", { children: [_jsx(ChevronRight, { size: 13, className: "chev" }), " ", t("ui.node_details.all_properties"), " ", _jsx("span", { className: "muted", children: props.length })] }), _jsxs("label", { className: "search nd-search", children: [_jsx(Search, { size: 12 }), _jsx("input", { value: filter, placeholder: t("ui.node_details.find_property"), onChange: (e) => setFilter(e.target.value) })] }), _jsx("dl", { className: "nd-props", children: props.map(([k, v]) => (_jsxs("div", { className: "nd-prop", children: [_jsx("dt", { children: k }), _jsx("dd", { title: v.length > 80 ? v : undefined, children: propValue(v) })] }, k))) })] }))] }));
|
|
161
|
+
}
|
package/pkg/OpIcon.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type LucideIcon } from "lucide-react";
|
|
2
|
+
import type { PlanNode } from "./types.js";
|
|
3
|
+
/** The operator families people recognize at a glance: a seek, a scan, a lookup, a hash or loop join, a sort. */
|
|
4
|
+
export declare function opIcon(node: Pick<PlanNode, "op" | "kind">): LucideIcon;
|
|
5
|
+
export declare function OpIcon({ node, size, color }: {
|
|
6
|
+
node: Pick<PlanNode, "op" | "kind">;
|
|
7
|
+
size?: number;
|
|
8
|
+
color?: string;
|
|
9
|
+
}): import("react").JSX.Element;
|
package/pkg/OpIcon.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowDownWideNarrow, Boxes, Calculator, Combine, CornerDownLeft, Funnel, GitMerge, Hash, Layers, ListOrdered, PencilLine, Repeat2, Rows3, ScanLine, ScanSearch, Shuffle, Sigma, Split, SquareFunction, Workflow, } from "lucide-react";
|
|
3
|
+
/** The operator families people recognize at a glance: a seek, a scan, a lookup, a hash or loop join, a sort. */
|
|
4
|
+
export function opIcon(node) {
|
|
5
|
+
const op = node.op.toLowerCase();
|
|
6
|
+
if (op.includes("lookup") && node.kind === "lookup")
|
|
7
|
+
return CornerDownLeft;
|
|
8
|
+
if (op.includes("nested loop"))
|
|
9
|
+
return Repeat2;
|
|
10
|
+
if (op.includes("hash"))
|
|
11
|
+
return Hash;
|
|
12
|
+
if (op.includes("merge join") || op === "merge")
|
|
13
|
+
return GitMerge;
|
|
14
|
+
if (op.includes("adaptive"))
|
|
15
|
+
return Shuffle;
|
|
16
|
+
if (op.startsWith("filter"))
|
|
17
|
+
return Funnel;
|
|
18
|
+
if (op === "top" || op === "limit" || op.startsWith("limit"))
|
|
19
|
+
return ListOrdered;
|
|
20
|
+
if (op.includes("constant") || op === "result" || op === "values scan")
|
|
21
|
+
return Rows3;
|
|
22
|
+
if (op === "query block" || op === "query" || op === "union")
|
|
23
|
+
return Boxes;
|
|
24
|
+
if (op.includes("compute scalar"))
|
|
25
|
+
return SquareFunction;
|
|
26
|
+
switch (node.kind) {
|
|
27
|
+
case "seek":
|
|
28
|
+
return ScanSearch;
|
|
29
|
+
case "scan":
|
|
30
|
+
return ScanLine;
|
|
31
|
+
case "lookup":
|
|
32
|
+
return CornerDownLeft;
|
|
33
|
+
case "join":
|
|
34
|
+
return Combine;
|
|
35
|
+
case "sort":
|
|
36
|
+
return ArrowDownWideNarrow;
|
|
37
|
+
case "aggregate":
|
|
38
|
+
return Sigma;
|
|
39
|
+
case "spool":
|
|
40
|
+
return Layers;
|
|
41
|
+
case "parallelism":
|
|
42
|
+
return Split;
|
|
43
|
+
case "modify":
|
|
44
|
+
return PencilLine;
|
|
45
|
+
case "compute":
|
|
46
|
+
return Calculator;
|
|
47
|
+
default:
|
|
48
|
+
return Workflow;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function OpIcon({ node, size = 14, color }) {
|
|
52
|
+
const Icon = opIcon(node);
|
|
53
|
+
return _jsx(Icon, { size: size, strokeWidth: 1.75, color: color, "aria-hidden": "true" });
|
|
54
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown, Info } from "lucide-react";
|
|
3
|
+
import { t } from "./host.js";
|
|
4
|
+
export function PlanAssessmentNotes({ note }) {
|
|
5
|
+
if (!note)
|
|
6
|
+
return null;
|
|
7
|
+
return (_jsxs("details", { className: "ins-context", children: [_jsxs("summary", { children: [_jsx(Info, { size: 13 }), t("ui.plan_insights.assessment_notes"), _jsx(ChevronDown, { size: 13, className: "ins-context-chevron" })] }), _jsx("p", { className: "ins-note", children: note })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type DiagramLens, type Mark } from "./PlanDiagram.js";
|
|
3
|
+
import type { PlanViewerTheme } from "./PlanViewer.js";
|
|
4
|
+
import type { Plan, PlanNode, QueryStat } from "./types.js";
|
|
5
|
+
export type PlanCanvasProps = {
|
|
6
|
+
plan: Plan;
|
|
7
|
+
query?: QueryStat | null;
|
|
8
|
+
/** Controlled active metric lens ("time" | "cost" | "rows" | "reads"). */
|
|
9
|
+
lens?: DiagramLens;
|
|
10
|
+
/** Initial metric lens when uncontrolled. */
|
|
11
|
+
defaultLens?: DiagramLens;
|
|
12
|
+
/** Selected operator node id. */
|
|
13
|
+
selectedId?: number | null;
|
|
14
|
+
/** Callback fired when an operator card is clicked. */
|
|
15
|
+
onSelect?: (id: number) => void;
|
|
16
|
+
/** Initial zoom factor (0.25 to 1.8). Auto-fits when omitted. */
|
|
17
|
+
initialZoom?: number;
|
|
18
|
+
/** Controlled zoom factor. */
|
|
19
|
+
zoom?: number;
|
|
20
|
+
onZoomChange?: (zoom: number) => void;
|
|
21
|
+
/** Show insight count badges and severity borders on operator cards. Defaults to false for pure flow rendering. */
|
|
22
|
+
showInsights?: boolean;
|
|
23
|
+
/** Show floating zoom/fit/minimap controls in the top-right corner. Defaults to true. */
|
|
24
|
+
showControls?: boolean;
|
|
25
|
+
/** Show the corner minimap. Defaults to automatic when >= 6 operators are visible. */
|
|
26
|
+
showMinimap?: boolean;
|
|
27
|
+
/** Explicit canvas height (e.g. 480 or "100%"). */
|
|
28
|
+
height?: number | string;
|
|
29
|
+
/** Diff change markers when rendering custom comparison views. */
|
|
30
|
+
marks?: Map<number, Mark>;
|
|
31
|
+
/** Shared region color tints (0..5). */
|
|
32
|
+
tints?: Map<number, number>;
|
|
33
|
+
/** Custom node overlay renderer. */
|
|
34
|
+
overlay?: (node: PlanNode, box: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
w: number;
|
|
38
|
+
h: number;
|
|
39
|
+
}) => ReactNode;
|
|
40
|
+
theme?: PlanViewerTheme;
|
|
41
|
+
className?: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Pure interactive execution-plan flow canvas: drag-to-pan, Ctrl/Cmd + wheel zoom, and optional minimap,
|
|
45
|
+
* with zero insight banners, prose summaries, headers, or built-in property drawers.
|
|
46
|
+
*/
|
|
47
|
+
export declare function PlanCanvas({ plan, query, lens, defaultLens, selectedId, onSelect, initialZoom, zoom, onZoomChange, showInsights, showControls, showMinimap, height, marks, tints, overlay, theme, className, }: PlanCanvasProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PlanDiagram } from "./PlanDiagram.js";
|
|
3
|
+
/**
|
|
4
|
+
* Pure interactive execution-plan flow canvas: drag-to-pan, Ctrl/Cmd + wheel zoom, and optional minimap,
|
|
5
|
+
* with zero insight banners, prose summaries, headers, or built-in property drawers.
|
|
6
|
+
*/
|
|
7
|
+
export function PlanCanvas({ plan, query, lens, defaultLens, selectedId, onSelect, initialZoom, zoom, onZoomChange, showInsights = false, showControls = true, showMinimap, height, marks, tints, overlay, theme, className, }) {
|
|
8
|
+
return (_jsx(PlanDiagram, { plan: plan, query: query, bare: true, showProps: false, showInsights: showInsights, showControls: showControls, showMinimap: showMinimap ?? undefined, lens: lens, defaultLens: defaultLens, height: height, selectedId: selectedId, onSelect: onSelect, initialZoom: initialZoom, zoom: zoom, onZoomChange: onZoomChange, marks: marks, tints: tints, overlay: overlay, theme: theme, className: className }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { costBasis as basis } from "./host.js";
|
|
3
|
+
import type { PlanViewerTheme } from "./PlanViewer.js";
|
|
4
|
+
import type { Plan, PlanNode, QueryStat } from "./types.js";
|
|
5
|
+
export declare function compactOp(op: string): string;
|
|
6
|
+
export type Mark = "changed" | "added" | "removed";
|
|
7
|
+
export type DiagramLens = "time" | "cost" | "rows" | "reads";
|
|
8
|
+
export declare const costBasis: typeof basis;
|
|
9
|
+
export declare function CostStrip({ plan, query, focus, onPick }: {
|
|
10
|
+
plan: Plan;
|
|
11
|
+
query?: QueryStat | null;
|
|
12
|
+
focus?: number | null;
|
|
13
|
+
onPick: (id: number) => void;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
export declare function PlanDiagram(props: {
|
|
16
|
+
plan: Plan;
|
|
17
|
+
query?: QueryStat | null;
|
|
18
|
+
focus?: number | null;
|
|
19
|
+
marks?: Map<number, Mark>;
|
|
20
|
+
selectedId?: number | null;
|
|
21
|
+
onSelect?: (id: number) => void;
|
|
22
|
+
initialZoom?: number;
|
|
23
|
+
badge?: string;
|
|
24
|
+
bare?: boolean;
|
|
25
|
+
tints?: Map<number, number>;
|
|
26
|
+
zoom?: number;
|
|
27
|
+
onZoomChange?: (zoom: number) => void;
|
|
28
|
+
showProps?: boolean;
|
|
29
|
+
showHeader?: boolean;
|
|
30
|
+
showActualSummary?: boolean;
|
|
31
|
+
showCostStrip?: boolean;
|
|
32
|
+
showInsights?: boolean;
|
|
33
|
+
showControls?: boolean;
|
|
34
|
+
showMinimap?: boolean;
|
|
35
|
+
lens?: DiagramLens;
|
|
36
|
+
defaultLens?: DiagramLens;
|
|
37
|
+
height?: number | string;
|
|
38
|
+
kindLabel?: string;
|
|
39
|
+
overlay?: (node: PlanNode, box: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
w: number;
|
|
43
|
+
h: number;
|
|
44
|
+
}) => ReactNode;
|
|
45
|
+
theme?: PlanViewerTheme;
|
|
46
|
+
className?: string;
|
|
47
|
+
}): import("react").JSX.Element;
|