But why is it doing any kind of network activity on a .connect(), if the previous connection was closed in the pool?
OK, I created a sandbox server, it'll probably be quicker for you as the server is in US, but this also did 18 sec for me. import time from sqlalchemy import create_engine e = create_engine("postgresql://postgres:sandbox@104.154.217.229/postgres") def go(): now = time.time() with e.connect() as conn: for i in range(100): conn.execute("select 1").fetchall() total = time.time() - now print("completed in %f sec" % (total, )) go() On Fri, 18 Jan 2019 at 22:54, Mike Bayer <mike...@zzzcomputing.com> wrote: > > On Fri, Jan 18, 2019 at 4:49 PM Zsolt Ero <zsolt....@gmail.com> wrote: > > > > I know I'm far away from a remote server, as the server is a Google > > Cloud SQL instance, and I'm in a residential cable connection. But > > ping times are only 145 ms, nothing extreme I'd say. If you'd like I > > can quickly setup a sandbox instance on GCP for trying this out. > > > > Still, I don't even understand the theory, shouldn't connection pools > > be the same speed as keeping one connection? > > the problem you are illustrating has nothing to do with the connection pool. > > > > > -- > > SQLAlchemy - > > The Python SQL Toolkit and Object Relational Mapper > > > > http://www.sqlalchemy.org/ > > > > To post example code, please provide an MCVE: Minimal, Complete, and > > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > > description. > > --- > > You received this message because you are subscribed to the Google Groups > > "sqlalchemy" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to sqlalchemy+unsubscr...@googlegroups.com. > > To post to this group, send email to sqlalchemy@googlegroups.com. > > Visit this group at https://groups.google.com/group/sqlalchemy. > > For more options, visit https://groups.google.com/d/optout. > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to a topic in the Google > Groups "sqlalchemy" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sqlalchemy/GEhwdHSBVbs/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.