You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Please reduce number of executed queries on PostgreSQL #54788
By default, Keycloak executes
DFE8
many SQL statements every three minutes to cleanup expired sessions. With lots of realms, this easily piles up to considerable squandering of resources - even if zero sessions exist!
My proposal would be to first check if there are any sessions in the table at all, and if not, do not rund lots of queries.
Alternatively, check the time of the first session the expire and wait until then, but do not execute SQL when it simply is not needed.
(On my PostgreSQL 18, a rather unused Keycloak produces 8% CPU load every three minutes)
Activity
ahus1 commentedon Nov 6, 2026
Sounds like a good improvement. The one thing we can't use is count the number of sessions (this is costly when there are a lot of sessions).