MCPcopy Create free account
hub / github.com/cameri/nostream / explain

Function explain

scripts/verify-index-impact.ts:221–231  ·  view source on GitHub ↗
(sql: string, params: unknown[])

Source from the content-addressed store, hash-verified

219}
220
221async function explain(sql: string, params: unknown[]): Promise<ExplainResult> {
222 const { rows } = await client.query<{ 'QUERY PLAN': ExplainResult[] }>(
223 `EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) ${sql}`,
224 params,
225 )
226 const plan = rows[0]?.['QUERY PLAN']?.[0]
227 if (!plan) {
228 throw new Error('EXPLAIN returned no plan')
229 }
230 return plan
231}
232
233function walk(node: ExplainPlanNode, visit: (n: ExplainPlanNode) => void): void {
234 visit(node)

Callers 1

measureFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected