Psycopg2 pool clarification

dieter dieter at handshake.de
Wed Jun 7 02:53:57 EDT 2017


israel <israel at ravnalaska.net> writes:
> Since I've gotten no replies to this, I was wondering if someone could
> at least confirm which behavior (my expected or my observed) is
> *supposed* to be the correct? Should a psycopg2 pool keep connections
> open when returned to the pool (if closed is False), or should it
> close them as long as there is more than minconn open? i.e is my
> observed behavior a bug or a feature?

You should ask the author[s] of "psycopg2" about the supposed behavior.


>From my point of view, everything depends on the meaning of the "min"
and "max" parameters for the pool.

You seem to interprete "max" as "keep as many connections as this open".
But it can also be a hard limit in the form "never open more than this
number of connections". In the latter case, "min" may mean "keep this
many connections open at all time".




More information about the Python-list mailing list