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 29, 2021

Nice! Thanks.

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