Re: Report planning memory in EXPLAIN ANALYZE
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
To: Andrei Lepikhov <a.lepikhov@postgrespro.ru>,
Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Andy Fan <zhihui.fan1213@gmail.com>,
jian he <jian.universality@gmail.com>, David Rowley <dgrowleyml@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-12-04T07:24:25Z
Lists: pgsql-hackers
Attachments
- 0002-EXPLAIN-reports-memory-consumed-for-plannin-20231204.patch (text/x-patch) patch 0002
- 0001-EXPLAIN-reports-memory-consumed-for-plannin-20231204.patch (text/x-patch) patch 0001
On Fri, Dec 1, 2023 at 8:27 AM Andrei Lepikhov <a.lepikhov@postgrespro.ru> wrote: > > On 30/11/2023 18:40, Alvaro Herrera wrote: > > Well, SUMMARY is enabled by default with ANALYZE, and I'd rather not > > have planner memory consumption displayed by default with all EXPLAIN > > ANALYZEs. So yeah, I still think this deserves its own option. > > > > But let's hear others' opinions on this point. I'm only one vote here. > > I agree; it should be disabled by default. The fact that memory > consumption outputs with byte precision (very uncomfortable for > perception) is a sign that the primary audience is developers and for > debugging purposes. That's 2 vs 1. Here's patch with MEMORY option added. Replying to Alvaro's earlier relevant comments. > If EXPLAIN (MEMORY) is added, then probably auto_explain needs a > corresponding flag, and doc updates. auto_explain does not implement planner_hook and hence can not gather information about planner's memory usage. So no new flag and doc update to auto_explain. I have added a comment auto_explain.c but probably even that's not needed. We are considering this option only for developers and auto_explain is largely for users. So I didn't feel like adding an implementation of planner_hook in auto_explain and use MEMORY option. If we feel that planner's memory usage report is useful in auto_explain, it should easy to do that in future. > The EXPLAIN docs (explain.sgml) need an update to mention the new flag > and the new output, too. Done. 0001 is as is except explain.out and explain.sgml changes reverted. 0002 following changes. It's a separate patch for ease of review. a. implements MEMORY option, adds tests in explain.sql and also updates explain.sgml. b. show_planning_memory renamed to show_planner_memory to be in sync with the output c. small indentation change by pgindent. -- Best Wishes, Ashutosh Bapat
Commits
-
Add EXPLAIN (MEMORY) to report planner memory consumption
- 5de890e3610d 17.0 landed
-
Fix explain regression test failure.
- eabba4a3eb71 14.0 cited