Re: Azure Postgresql High connection establishment time

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Abhay Gupta <gupta(dot)abhay86(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Azure Postgresql High connection establishment time
Date: 2021-09-20 17:16:20
Message-ID: 1817783.1632158180@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Abhay Gupta <gupta(dot)abhay86(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Abhay Gupta 2021-09-20 17:37:52 Re: Azure Postgresql High connection establishment time
Previous Message Michael Lewis 2021-09-20 17:13:50 Re: Azure Postgresql High connection establishment time