Skip to content

Instantly share code, notes, and snippets.

@m-arrieta-r
Last active September 25, 2022 22:04
Show Gist options
  • Save m-arrieta-r/755a50c6569d9d5947fb05aa907cd2d8 to your computer and use it in GitHub Desktop.
Save m-arrieta-r/755a50c6569d9d5947fb05aa907cd2d8 to your computer and use it in GitHub Desktop.
Simple performance test - Prisma 2 vs mysql Driver
function getOrdersById(id: number) {
console.time('NewPrismaClient');
const prisma = new PrismaClient();
console.timeEnd('NewPrismaClient');
console.time('OrmQuery');
await prisma.tb_orders.findMany({
where: {
orderId: id,
},
});
console.timeEnd('OrmQuery');
console.time('DriverQuery');
await this.databaseRepository.query(`SELECT *
FROM tb_orderItems
WHERE orderId = ${id}`);
console.timeEnd('DriverQuery');
}
@dougg0k
Copy link

dougg0k commented Oct 22, 2021

Can you share the results with the latest version of Prisma? prisma/prisma#5819

@m-arrieta-r
Copy link
Author

I do not have the same DB now. But I created a similar environment with docker + postgres. And the new prisma version is faster :).

Evidence:

Example with prisma 3.30.0

image

Example with prisma 2.17.0

image

I'm going to try to add more tests with mysql and remote DB.

@dougg0k
Copy link

dougg0k commented Oct 29, 2021

Nice! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment