Re: Azure Postgresql High connection establishment time - Mailing list pgsql-general

From Tom Lane
Subject Re: Azure Postgresql High connection establishment time
Date
Msg-id 1817783.1632158180@sss.pgh.pa.us
Whole thread Raw
In response to Azure Postgresql High connection establishment time  (Abhay Gupta <gupta.abhay86@gmail.com>)
Responses Re: Azure Postgresql High connection establishment time  (Abhay Gupta <gupta.abhay86@gmail.com>)
List pgsql-general
Abhay Gupta <gupta.abhay86@gmail.com> writes:
> we are noticing the connection establishment is taking around 200-300 ms.

Not sure whether that's out of line or not, since you've provided
no background data (e.g. is the connection across a network link?
how busy is the server? what encryption and authentication are
you using?).  However ...

> The connection establishment time is very high as our functions are written
> to be very high performance.

... if you are looking for good performance, the last thing you
should be doing is making a connection per query.  Postgres backend
processes are pretty heavyweight things.  Even after the connection
is complete, there's overhead involved in populating caches and so
forth.  You'd be well-served to use a connection pooler and/or try
to keep an application's connection open once made.

            regards, tom lane



pgsql-general by date:

Previous
From: Michael Lewis
Date:
Subject: Re: Azure Postgresql High connection establishment time
Next
From: Abhay Gupta
Date:
Subject: Re: Azure Postgresql High connection establishment time