Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qETFY-0006Fm-1t for pgsql-general@arkaria.postgresql.org; Wed, 28 Jun 2023 11:22:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qETFV-0005GT-Qe for pgsql-general@arkaria.postgresql.org; Wed, 28 Jun 2023 11:22:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qETFV-0005GK-G6 for pgsql-general@lists.postgresql.org; Wed, 28 Jun 2023 11:22:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qETFS-000uMr-UO for pgsql-general@lists.postgresql.org; Wed, 28 Jun 2023 11:22:12 +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 35SBM9JQ1141125; Wed, 28 Jun 2023 07:22:09 -0400 From: Tom Lane To: Dominique Devienne cc: pgsql-general@lists.postgresql.org Subject: Re: LibPQ: PQresultMemorySize as proxy to transfered bytes In-reply-to: <1140652.1687950987@sss.pgh.pa.us> References: <1140652.1687950987@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 28 Jun 2023 07:16:27 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1141123.1687951329.1@sss.pgh.pa.us> Date: Wed, 28 Jun 2023 07:22:09 -0400 Message-ID: <1141124.1687951329@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > That number is the total space actually requested from malloc() for > the PGresult object. But we request space in blocks (typically 2KB > each), so there's some overhead due to fields not exactly filling > a block, unused space in the last block, etc. If you're testing > with very small result sets (say a couple hundred KB) Sigh, obviously I meant a couple hundred *bytes* there. -ENOCAFFEINE regards, tom lane