kysely
    Preparing search index...

    Interface Explainable

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

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    Methods

    • 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
      

      Type Parameters

      • O extends Record<string, any> = Record<string, any>

      Parameters

      Returns Promise<O[]>