Execute MySQL EXPLAIN for Prisma queries in development environments. Current stable version is 0.3.0, released on an as-needed cadence. It intercepts Prisma query events, runs EXPLAIN, and caches results to avoid redundant executions. Key differentiators: deeply integrates with Prisma's event system, supports multiple caching strategies (by query, by params, or none), and provides typed results. Designed exclusively for development; not safe for production.
npm install prisma-mysql-explainNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Set up Prisma with query event logging and create an explain listener that logs EXPLAIN results for every query.
Update code: use `const explainer = createExplain(prisma, opts);` (no longer `new Explain()`).
Ensure PrismaClient is connected to a MySQL database.
Pass the log option when instantiating PrismaClient.
Use `query` cacheType instead to achieve similar behavior.
Use `import { createExplain } from 'prisma-mysql-explain'`.Ensure tsconfig.json has `"module": "ESNext"` or run with `--experimental-modules` flag.
Import `createExplain` and then call it to get an object with the `explain` method.
Call `createExplain(prisma)` or `createExplain(prisma, { cacheType: 'query' })`.