We are using Postgresql for sessions and recently, within the last few weeks (though no updates have happened during this time) we have noticed that there has been a sharp increase in the number of users which are reporting that they're unable to log in as the session wait timeout is being hit.
What I'm seeing is a bunch of long running processes seem to start piling up in the database just prior to these issues appearing, and my current theory is that these processes are locking the database in some way which stops new sessions being made - But I'm not sure what the queries are doing (I'm far from a DBA), why they're doing it or how to stop it happening. I've seen a few suggestions that I should move to File-based sessions but as this problem only arose recently I'm keen to understand what the problem is and not just work around it as it could be impacting other things
the three most common queries I'm seeing (in order of how commonly i'm seeing them run over 1 minute) are
SELECT * FROM mdl_user WHERE mnethostid = $1 AND id = $2 AND deleted = $3
SELECT uif.*, uic.name AS categoryname , uind.id AS hasuserdata, uind.data, uind.dataformat FROM mdl_user_info_field uif LEFT JOIN mdl_user_info_category uic ON uif.categoryid = uic.id LEFT JOIN mdl_user_info_data uind ON uif.id = uind.fieldid AND uind.userid = $1 ORDER BzqY uic.sortorder ASC, uif.sortorder ASC
Any help would be appreciated! I am somewhat at a loss