Re: explain format json, unit for serialize and memory are different.

2024-05-15 Thread David Rowley
On Wed, 15 May 2024 at 13:23, Tom Lane wrote: > > Michael Paquier writes: > > Perhaps Alvaro and Tom would like to chime in, as committers of > > respectively 5de890e3610d and 06286709ee06? > > No objection here. In a green field I might argue for > round-to-nearest instead of round-up, but it

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread David Rowley
On Wed, 15 May 2024 at 15:40, jian he wrote: > I am looking for an example where this information under json key > "Serialization" is not zero. > So far I have tried: Something that requires detoasting. > create table s(a text); > insert into s select repeat('a', 1024) from

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread jian he
On Wed, May 15, 2024 at 10:13 AM David Rowley wrote: > > On Wed, 15 May 2024 at 13:44, jian he wrote: > >"Shared Hit Blocks": 0, > >"Shared Read Blocks": 0, > >"Shared Dirtied Blocks": 0, > >"Shared Written Blocks": 0, > >"Local Hit Blocks": 0, > >

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread David Rowley
On Wed, 15 May 2024 at 13:44, jian he wrote: >"Shared Hit Blocks": 0, >"Shared Read Blocks": 0, >"Shared Dirtied Blocks": 0, >"Shared Written Blocks": 0, >"Local Hit Blocks": 0, >"Local Read Blocks": 0, >"Local Dirtied Blocks": 0, >

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread jian he
explain (format json, analyze, wal, buffers, memory, serialize) insert into tenk1 select * from tenk1 limit 1; QUERY PLAN --- [ { "Plan": { "Node Type": "ModifyTable", "Operation": "Insert", "Parallel

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread Tom Lane
Michael Paquier writes: > Perhaps Alvaro and Tom would like to chime in, as committers of > respectively 5de890e3610d and 06286709ee06? No objection here. In a green field I might argue for round-to-nearest instead of round-up, but it looks like we have several precedents for round-up, so let's

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread Michael Paquier
On Wed, May 15, 2024 at 02:01:21AM +1200, David Rowley wrote: > Yeah, I missed that. Here's another patch. > > Thanks for looking. Thanks for bringing in a patch that makes the whole picture more consistent across the board. When it comes to MEMORY, I can get behind your suggestion to use kB

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread David Rowley
On Wed, 15 May 2024 at 01:18, jian he wrote: > else > { > ExplainPropertyInteger("Memory Used", "bytes", >mem_counters->totalspace - mem_counters->freespace, >es); > ExplainPropertyInteger("Memory Allocated", "bytes", >mem_counters->totalspace, es); > } > } > > the "else" branch, also

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread jian he
On Tue, May 14, 2024 at 6:33 PM David Rowley wrote: > > On Tue, 14 May 2024 at 18:16, David Rowley wrote: > > I think for v17, we should consider adding a macro to explain.c to > > calculate the KB from bytes. There are other inconsistencies that it > > would be good to address. We normally

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread David Rowley
On Tue, 14 May 2024 at 18:16, David Rowley wrote: > I think for v17, we should consider adding a macro to explain.c to > calculate the KB from bytes. There are other inconsistencies that it > would be good to address. We normally round up to the nearest kilobyte > with (bytes + 1023) / 1024, but

Re: explain format json, unit for serialize and memory are different.

2024-05-14 Thread David Rowley
On Tue, 14 May 2024 at 17:40, Michael Paquier wrote: > > On Mon, May 13, 2024 at 11:22:08AM +0200, Daniel Gustafsson wrote: > > Since json (and yaml/xml) is intended to be machine-readable I think we use > > a > > single unit for all values, and document this fact. > > Agreed with the

Re: explain format json, unit for serialize and memory are different.

2024-05-13 Thread Michael Paquier
On Mon, May 13, 2024 at 11:22:08AM +0200, Daniel Gustafsson wrote: > Since json (and yaml/xml) is intended to be machine-readable I think we use a > single unit for all values, and document this fact. Agreed with the documentation gap. Another thing that could be worth considering is to add the

Re: explain format json, unit for serialize and memory are different.

2024-05-13 Thread Daniel Gustafsson
> On 13 May 2024, at 11:16, jian he wrote: > under format json, "Output Volume": 1143, > 1143 is kiB unit, and is not the same as "Memory Used" or "Memory > Allocated" byte unit. Nice catch. > Do we need to convert it to byte for the non-text format option for EXPLAIN? Since json (and

explain format json, unit for serialize and memory are different.

2024-05-13 Thread jian he
hi. explain(analyze, format json, serialize, memory, costs off, Timing off) select * from tenk1; QUERY PLAN - [ { "Plan": { "Node Type": "Seq Scan", "Parallel Aware": false, "Async Capable": false, "Relation Name":