The following example logs the time taken for a Prisma Query to run:

const prisma = new PrismaClient()
prisma.$use(async (params, next) => {
const before =
const result = await next(params)
const after =
console.log(`Query ${params.model}.${params.action} took ${after - before}ms`)
return result
const create = await{
data: {
title: 'Welcome to Prisma Day 2020',
const createAgain = await{
data: {
title: 'All about database collation',

Example output:

Query Post.create took 92ms
Query Post.create took 15ms

The example is based on the following sample schema:

generator client {
provider = "prisma-client-js"
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
model Post {
authorId Int?
content String?
id Int @id @default(autoincrement())
published Boolean @default(false)
title String
user User? @relation(fields: [authorId], references: [id])
language String?
@@index([authorId], name: "authorId")
model User {
email String @unique
id Int @id @default(autoincrement())
name String?
posts Post[]
extendedProfile Json?
role Role @default(USER)
enum Role {
Edit this page on GitHub