I have a multi-threaded process whereby 36 threads write to the db randomly, each once every 10s on average, each with 99% idle time (sleeping).
I am not sure if this means I have 36 active connections, or effectively just one or two because of the sleep in each thread. Probably not relevant but they all use the same username.
Should I reduce the max-connections option in the config file to 36 or to something small like 4 (to reflect the probability that at any instant in time, almost certainly not more than 4 are simultaneously writing)?
Edit: is it possible that its implementation dependent, i.e. how I wrote my python code whether the connections are dropped while sleeping or not?