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

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 Michal Charemza
gmail.com> wrote: > > > 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 >&

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-21 Thread Michal Charemza
Tom Lane writes: > Do you do bulk > permissions updates that might affect thousands of role memberships at > once? So we do regularly update role memberships - essentially a sync from a separate database, and some could well have happened just before connections, but it's more in the tens at a ti