
DizzyNugget
3moby
Postgresql query execution time issue
Hello everyone, Hey i faced latency issue when connect fastapi with postgresql , query execution took 500ms time, when we run same query on server it took only 0.120 ms . How i efficiently connect with it. Waiting for the response.
3mo ago

GoofyCupcake
3mo
My guess is your configuration is initiating a fresh connection everytime you execute a query (inside your FastAPI app). Solution is to use a connection pool (SqlAlchemy provides it out of the box, and so does psycopg2).
Discover more
Curated from across