Skip to main content
Module

x/kysely_deno_postgres_dialect/mod.ts>kysely.Explainable

Kysely dialect for PostgreSQL using the deno-postgres client.
Latest
interface kysely.Explainable
Re-export
import { type kysely } from "https://deno.land/x/kysely_deno_postgres_dialect@v0.27.1/mod.ts";
const { Explainable } = kysely;

Methods

explain<O extends Record<string, any> = Record<string, any>>(format?: ExplainFormat, options?: Expression<any>): Promise<O[]>

Executes query with explain statement before the main query.

const explained = await db
 .selectFrom('person')
 .where('gender', '=', 'female')
 .selectAll()
 .explain('json')

The generated SQL (MySQL):

explain format=json select * from `person` where `gender` = ?

You can also execute explain analyze statements.

import { sql } from 'kysely'

const explained = await db
 .selectFrom('person')
 .where('gender', '=', 'female')
 .selectAll()
 .explain('json', sql`analyze`)

The generated SQL (PostgreSQL):

explain (analyze, format json) select * from "person" where "gender" = $1