#Large overhead on a query

3 messages · Page 1 of 1 (latest)

analog geyser
#

Hi, I have the following database query in my backend code:

        const data = await CLIENT_INSTANCE.someTable.findMany({
            select: {
                col1: true,
                col2: true
            },
            where: {
                table2: {
                    table3: {
                        id: myTable3Elt.id,
                        col5: true
                    }
                }
            }
        });

It includes 2 joins and I expect up to 1M results, so I'm fine with a runtime of .5s or so. The database query itself executes in around 300ms -- both according to the database logs and the prisma logging, but the entire TS line executes for 2 seconds. Does anyone know why that might be? Is it normal to expect such a large overhead when a large number of rows is involved?

#

Large overhead on a query

#

FWIW, this behaviour reproduces both in bun and in nodejs. I'm running my app on an arm CPU (raspberry pi 4), using the official postgreSQL docker image. Prisma version:

        "node_modules/@prisma/client": {
            "version": "5.7.0",