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 1m1m79-0000Nt-Br for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Jul 2021 08:44:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m1m77-0000zy-TK for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Jul 2021 08:44:01 +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 1m1m77-0000x4-LB for pgsql-bugs@lists.postgresql.org; Fri, 09 Jul 2021 08:44:01 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m1m75-00073k-1L for pgsql-bugs@lists.postgresql.org; Fri, 09 Jul 2021 08:44:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Reply-To: Message-ID:Subject:To:Sender:From:Date:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=y0h73/j5QarzYsnLbTum9joVJzeeh0KHXd5HVq8QlnM=; b=aJQnDsRK5fjkfcpwhf1r2S0RY1 gRtFJ4Kcst0konduBOn8o6ROjNQgn9YdSOtZ9U101ORB7XGcXvUeVDmjrxpGomVL7vIxSUxH7DTHB CjZBqGtundlOxBbbORBoGbKVoTpkBT1bxL4uhp15whQk3xnqYiVUNf8iKVCPCz3+QtJo=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1m1m72-0002GI-0K for pgsql-bugs@lists.postgresql.org; Fri, 09 Jul 2021 10:43:56 +0200 Date: Fri, 9 Jul 2021 10:43:55 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: PostgreSQL mailing lists Subject: I/O timigns don't include time for temp buffers Message-ID: <20210709084355.GA6251@depesz.com> Reply-To: depesz@depesz.com MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I tested it on newest 15devel from git, but I believe it goes back. It looks that I/O timings in explain show that that was necessary to read/write *shared* and *local* buffers, but temp are excluded for some reason. For example: $ explain (analyze, buffers) select count(*) from plans.part_0; QUERY PLAN ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Aggregate (cost=464.74..464.75 rows=1 width=8) (actual time=14.580..14.582 rows=1 loops=1) Buffers: shared hit=13 read=16 dirtied=7 I/O Timings: read=6.325 -> Index Only Scan using part_0_added_by_idx on part_0 (cost=0.29..413.82 rows=20369 width=0) (actual time=0.031..11.428 rows=20359 loops=1) Heap Fetches: 50 Buffers: shared hit=13 read=16 dirtied=7 I/O Timings: read=6.325 Planning: Buffers: shared hit=166 Planning Time: 0.414 ms Execution Time: 14.618 ms (11 rows) Shows that we have normal I/O Timings info, 6.3ms for reading 16 pages. But when I don't touch any shared/local pages: $ explain (analyze, buffers) select count(*) from generate_series(1,10000000); QUERY PLAN ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Aggregate (cost=125000.00..125000.01 rows=1 width=8) (actual time=1536.899..1536.900 rows=1 loops=1) Buffers: temp read=17090 written=17090 -> Function Scan on generate_series (cost=0.00..100000.00 rows=10000000 width=0) (actual time=611.066..1210.260 rows=10000000 loops=1) Buffers: temp read=17090 written=17090 Planning Time: 0.071 ms JIT: Functions: 4 Options: Inlining false, Optimization false, Expressions true, Deforming true Timing: Generation 0.202 ms, Inlining 0.000 ms, Optimization 0.089 ms, Emission 1.528 ms, Total 1.819 ms Execution Time: 1565.635 ms (10 rows) The I/O timings info is fully missing. With more info you can see it in https://explain.depesz.com/s/xWRP#source Line 11 (Hash) has info: Buffers: shared hit=229 read=19,627 written=3, temp written=1,100 I/O Timings: read=31.173 write=0.049 and it's only subnode (Nested loop) shows: Buffers: shared hit=229 read=19,627 written=3 I/O Timings: read=31.173 write=0.049 This shows that the Hash wrote 1100 temp buffers, but I/O timings didn't increase at all. So far it looks that only shared/local buffers are taken into account for I/O timings, but, as far as I can read it, https://www.postgresql.org/docs/current/sql-explain.html doesn't mention this. Best regards, depesz