PrismaP
Prisma4mo ago
3 replies
goYsticks

Rust-Free Is 3x Slower

Has this been already reported? On a local Postgres database I was getting a massive number of transaction timeout messages running out seed script. Ended up with this config to avoid those.
new PrismaClient({
      transactionOptions: {
        maxWait: 300000,
        timeout: 300000,
      },
      log: process.env.HIDE_PRISMA_QUERY === "true" ? [] : ["query"],
      adapter: new PrismaPg({
        connectionString: getDBUrl(),
        idle_in_transaction_session_timeout: 15000,
        statement_timeout: 15000,
        query_timeout: 15000,
        connectionTimeoutMillis: 15000,
      }),
    })


Rust + Non-ESM - Seeding Complete in 166.956seconds
Rust + ESM - Seeding Complete in 149.892 seconds
Rust Free + ESM - Seeding Complete in 557.726 seconds

Thats from just changing

generator client {
  provider        = "prisma-client"
  output          = "../../prisma-generated"
  previewFeatures = ["views"]
  binaryTargets   = ["native", "rhel-openssl-3.0.x"]
}


to this

generator client {
  provider        = "prisma-client"
  output          = "../../prisma-generated"
  previewFeatures = ["views"]
  engineType      = "client"
}


and running npx prisma generate before the seed script.

Our seed script uses functions from our application code, with seed data and some use of fakerjs. That is a lot of prisma upsert statements with deep nesting, and deep returns. That we then run synchronously with Promise.all([..]);
Was this page helpful?