Re: Extremely slow to establish connection when user has a high number of roles

2024-04-20 Thread Tom Lane
Michal Charemza writes: > Tom Lane writes: >> It's not very clear what you mean by "sometimes". Is the slowness > reproducible for a particular user and role configuration, or does > it seem to come and go by itself? > Ah it's more come and go by itself - as in one connection takes 30 seconds,

Re: Extremely slow to establish connection when user has a high number of roles

2024-04-20 Thread Michal Charemza
Frits Hoogland writes: > Michael, can you validate if this is consistently happening for the first connection after database cluster startup? Hmmm... it'll be tricky and need some planning. It might even be impossible since this is on AWS Aurora, and I think AWS connects in regularly as part of a

Re: Extremely slow to establish connection when user has a high number of roles

2024-04-20 Thread Frits Hoogland
Michael, can you validate if this is consistently happening for the first connection after database cluster startup? Frits > Op 20 apr 2024 om 04:55 heeft Michal Charemza het > volgende geschreven: > >  > Hi, > > We're running PostgreSQL as essentially a data warehouse, and we have a few >

Re: Extremely slow to establish connection when user has a high number of roles

2024-04-20 Thread Michal Charemza
Vijaykumar Jain writes: > can you rule out system catalog bloat ? I don't know! I've now run the query from https://wiki.postgresql.org/wiki/Show_database_bloat just just on pg_catalog, results attached On Sat, Apr 20, 2024 at 3:52 PM Vijaykumar Jain < vijaykumarjain.git...@gmail.com> wrote: >

Re: Extremely slow to establish connection when user has a high number of roles

2024-04-20 Thread Michal Charemza
Tom Lane writes: > It's not very clear what you mean by "sometimes". Is the slowness reproducible for a particular user and role configuration, or does it seem to come and go by itself? Ah it's more come and go by itself - as in one connection takes 30 seconds, then the next say 0.06s. It's happ

Re: Extremely slow to establish connection when user has a high number of roles

2024-04-20 Thread Vijaykumar Jain
On Sat, Apr 20, 2024, 5:25 PM Michal Charemza wrote: > Hi, > > We're running PostgreSQL as essentially a data warehouse, and we have a > few thousand roles, which are used to grant permissions on a table-by-table > basis to a few thousand users, so a user would typically have say between 1 > and

Re: Extremely slow to establish connection when user has a high number of roles

2024-04-20 Thread Tom Lane
Michal Charemza writes: > The issue is that we're hitting a strange performance problem on > connection. Sometimes it can take ~25 to 40 seconds just to connect, > although it's often way quicker. There seems to be no middle ground - never > have I seen a connection take between 0.5 and 25 seconds

Re: Extremely slow to establish connection when user has a high number of roles

2024-04-20 Thread Tomas Vondra
On 4/20/24 13:55, Michal Charemza wrote: > Hi, > > We're running PostgreSQL as essentially a data warehouse, and we have a few > thousand roles, which are used to grant permissions on a table-by-table > basis to a few thousand users, so a user would typically have say between 1 > and 2 thousand ro

Extremely slow to establish connection when user has a high number of roles

2024-04-20 Thread Michal Charemza
Hi, We're running PostgreSQL as essentially a data warehouse, and we have a few thousand roles, which are used to grant permissions on a table-by-table basis to a few thousand users, so a user would typically have say between 1 and 2 thousand roles. There is also quite a lot of "churn" in terms of