I am using sqlalchemy for the access to a postgresql DB.
My problem is that I have a loop that creates several processes that in turn create sessions for querying and writing data in the database. It turned out that they are very fast and that more sessions have been created that the DB can handle. Is there any way that I can query the status of DB regarding the number of sessions and their duration and to synchronize the creation of sessions; that is to start new process only after the moment the DB are ready to open new sessions?
Hi, thanks for the answer,
I have got 2 problems:
I cannot map this table:
sqlalchemy.exc.ArgumentError: Mapper Mapper|MyTable|pg_stat_activity could not assemble any primary key columns for mapped table 'pg_stat_activity'
2) I cannot figure out what is the maximal allowed number of session and which colons are relevant for the session menagement, I see id, port and ip address of the user but how this can be applied for the session management?