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 1mzXlw-00067O-My for pgsql-performance@arkaria.postgresql.org; Tue, 21 Dec 2021 05:33:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mzXlv-0007Vg-G8 for pgsql-performance@arkaria.postgresql.org; Tue, 21 Dec 2021 05:33:11 +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 1mzXlv-0007VJ-6Q for pgsql-performance@lists.postgresql.org; Tue, 21 Dec 2021 05:33:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzXls-0001kK-M2 for pgsql-performance@lists.postgresql.org; Tue, 21 Dec 2021 05:33:10 +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 1BL5X6w02707818; Tue, 21 Dec 2021 00:33:06 -0500 From: Tom Lane To: "David G. Johnston" cc: Justin Pryzby , Lars Bergeson , "pgsql-performance@lists.postgresql.org" Subject: Re: Query is slower with a large proportion of NULLs in several columns In-reply-to: References: <2688019.1640051519@sss.pgh.pa.us> <20211221045138.GZ17618@telsasoft.com> <2704544.1640062888@sss.pgh.pa.us> Comments: In-reply-to "David G. Johnston" message dated "Mon, 20 Dec 2021 22:08:59 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2707816.1640064786.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 21 Dec 2021 00:33:06 -0500 Message-ID: <2707817.1640064786@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > On Monday, December 20, 2021, Tom Lane wrote: >> It would help if somebody had labeled the units of I/O Time >> ... but I'm guessing those are microsec vs. the millisec >> of the other times, because otherwise it's completely wrong. > Related to my preceding observation, from the explain (buffers) docs: > =E2=80=9C=E2=80=A6and the time spent reading and writing data file block= s (in milliseconds) > if track_io_timing > > is enabled.=E2=80=9C Hmm ... the code sure looks like it's supposed to be millisec: appendStringInfoString(es->str, "I/O Timings:"); if (!INSTR_TIME_IS_ZERO(usage->blk_read_time)) appendStringInfo(es->str, " read=3D%0.3f", INSTR_TIME_GET_MILLISEC(usage->blk_read_t= ime)); if (!INSTR_TIME_IS_ZERO(usage->blk_write_time)) appendStringInfo(es->str, " write=3D%0.3f", INSTR_TIME_GET_MILLISEC(usage->blk_write_= time)); And when I try some cases here, I get I/O timing numbers that are consistent with the overall time reported by EXPLAIN, for example Seq Scan on foo (cost=3D0.00..843334.10 rows=3D11000010 width=3D508) (ac= tual time=3D0. 015..1897.492 rows=3D11000000 loops=3D1) Buffers: shared hit=3D15874 read=3D717460 I/O Timings: read=3D1184.638 Planning: Buffers: shared hit=3D5 read=3D2 I/O Timings: read=3D0.025 Planning Time: 0.229 ms Execution Time: 2151.529 ms So now we have a real mystery about what is happening on Lars' system. Those numbers can't be right. regards, tom lane