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 1vAWih-002dId-Tv for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Oct 2025 16:57:23 +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 1vAWig-00BUms-Hh for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Oct 2025 16:57:21 +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 1vAWig-00BUmk-8Y for pgsql-hackers@lists.postgresql.org; Sun, 19 Oct 2025 16:57:21 +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.96) (envelope-from ) id 1vAWic-00350n-2D for pgsql-hackers@lists.postgresql.org; Sun, 19 Oct 2025 16:57:20 +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 59JGvGoN2264271 for ; Sun, 19 Oct 2025 12:57:16 -0400 From: Tom Lane To: pgsql-hackers@lists.postgresql.org Subject: Re: gzgetc() is hazardous to your health In-reply-to: <2122679.1760846783@sss.pgh.pa.us> References: <2122679.1760846783@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 19 Oct 2025 00:06:23 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2264269.1760893036.1@sss.pgh.pa.us> Date: Sun, 19 Oct 2025 12:57:16 -0400 Message-ID: <2264270.1760893036@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > What I think we ought to do about this is get rid of our one usage > of gzgetc(), replacing it with a one-byte gzread() operation. > That's not lovely from a speed perspective, but I don't think that > reading a pg_dump TOC file is really speed-critical. In the light of morning I had a better, or at least easier, idea: just #undef gzgetc and fall back on the underlying function. That's at least a little faster than gzread(), too. regards, tom lane