cesar sampaio
cesar sampaio
PPrisma
Created by cesar sampaio on 10/30/2024 in #help-and-questions
prisma postgres
3 replies
PPrisma
Created by Luxaritas on 10/20/2023 in #help-and-questions
How does Priama handle connection cleanup in the connection pool?
did u ever figured out the answer? @Luxaritas
3 replies
PPrisma
Created by cesar sampaio on 9/26/2024 in #help-and-questions
How to kill idle connections properly in postgres
import { Prisma } from '@prisma/client'
import * as Sentry from '@sentry/node'
import { ApolloError } from 'apollo-server'
import { ErrorCode } from '../models'

export const prismaOptions: Prisma.Subset<
Prisma.PrismaClientOptions,
Prisma.PrismaClientOptions
> = {
errorFormat: 'pretty',
// log: ['info', 'query'],
datasources: {
db: {
url: `${process.env.DATABASE_URL}?connection_limit=500&pool_timeout=0`,
},
},
}

export const prismaOptionsReadOnly: Prisma.Subset<
Prisma.PrismaClientOptions,
Prisma.PrismaClientOptions
> = {
...prismaOptions,
// log: ['info', 'query'],
datasources: {
db: {
url: process.env.RO_DATABASE_URL
? `${process.env.RO_DATABASE_URL}?connection_limit=500&pool_timeout=0&connect_timeout=30`
: `${process.env.DATABASE_URL}?connection_limit=500&pool_timeout=0`,
},
},
}
import { Prisma } from '@prisma/client'
import * as Sentry from '@sentry/node'
import { ApolloError } from 'apollo-server'
import { ErrorCode } from '../models'

export const prismaOptions: Prisma.Subset<
Prisma.PrismaClientOptions,
Prisma.PrismaClientOptions
> = {
errorFormat: 'pretty',
// log: ['info', 'query'],
datasources: {
db: {
url: `${process.env.DATABASE_URL}?connection_limit=500&pool_timeout=0`,
},
},
}

export const prismaOptionsReadOnly: Prisma.Subset<
Prisma.PrismaClientOptions,
Prisma.PrismaClientOptions
> = {
...prismaOptions,
// log: ['info', 'query'],
datasources: {
db: {
url: process.env.RO_DATABASE_URL
? `${process.env.RO_DATABASE_URL}?connection_limit=500&pool_timeout=0&connect_timeout=30`
: `${process.env.DATABASE_URL}?connection_limit=500&pool_timeout=0`,
},
},
}
thats how I instatiate them
5 replies
PPrisma
Created by cesar sampaio on 9/26/2024 in #help-and-questions
How to kill idle connections properly in postgres
I have pods with 500 connections limit and reaching the limit. max connection in db level is 5000 but I see some pods with very old and idle connection reaching 500 in rds i see 1600 connections
5 replies