Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sGolW-00HW8n-J5 for pgsql-general@arkaria.postgresql.org; Mon, 10 Jun 2024 23:49:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sGolV-0004la-7f for pgsql-general@arkaria.postgresql.org; Mon, 10 Jun 2024 23:49:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sGolU-0004lR-T2 for pgsql-general@lists.postgresql.org; Mon, 10 Jun 2024 23:49:29 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sGolT-0010px-AI for pgsql-general@postgresql.org; Mon, 10 Jun 2024 23:49:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 45ANnP37927474; Mon, 10 Jun 2024 19:49:25 -0400 From: Tom Lane To: Thomas Munro cc: Dominique Devienne , pgsql-general@postgresql.org Subject: Re: libpq v17 PQsocketPoll timeout is not granular enough In-reply-to: References: Comments: In-reply-to Thomas Munro message dated "Tue, 11 Jun 2024 10:59:28 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <927472.1718063365.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 10 Jun 2024 19:49:25 -0400 Message-ID: <927473.1718063365@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Munro writes: > On Tue, Jun 11, 2024 at 2:36=E2=80=AFAM Dominique Devienne wrote: >> PQsocketPoll() being based on time_t, it has only second resolution, AF= AIK. >> Despite the [underlying implementation in fe-misc.c][2] supporting at >> least milliseconds. > Yeah, that is not nice and your complaint is very reasonable, and we > should probably do something like what Tom suggested. > Hmm, but if what I speculated above is true, I wonder if the extern > function is even worth its bits... but I don't know how to determine > that completely. I think if we're going to change anything at all here, we should define the external API in microseconds not milliseconds. The lesson we need to be taking from this is that system calls come and go, but libpq API is forever ;-). Somebody could conceivably want sub-millisecond wait resolution within the lifespan of libpq. regards, tom lane