Re: Explain: Duplicate key "Workers" in JSON format - Mailing list pgsql-hackers

From Jehan-Guillaume de Rorthais
Subject Re: Explain: Duplicate key "Workers" in JSON format
Date
Msg-id 20191205175952.7e6f0555@firost
Whole thread Raw
In response to Re: Explain: Duplicate key "Workers" in JSON format  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Responses Re: Explain: Duplicate key "Workers" in JSON format
List pgsql-hackers
Hi hackers,

On Fri, 23 Aug 2019 09:30:59 -0400
Andrew Dunstan <andrew.dunstan@2ndquadrant.com> wrote:

> On 8/23/19 8:47 AM, Pierre Giraud wrote:
> >       "Plans": [
> >         {
> >           "Node Type": "Sort",
> >           "Parent Relationship": "Outer",
> >           "Parallel Aware": false,
> >           "Actual Startup Time": 1558.638,
> >           "Actual Total Time": 2127.522,
> >           "Actual Rows": 3333333,
> >           "Actual Loops": 3,
> >           "Output": ["c1", "c2"],
> >           "Sort Key": ["t1.c1"],
> >           "Sort Method": "external merge",
> >           "Sort Space Used": 126152,
> >           "Sort Space Type": "Disk",
> >           "Workers": [
> >             {
> >               "Worker Number": 0,
> >               "Sort Method": "external merge",
> >               "Sort Space Used": 73552,
> >               "Sort Space Type": "Disk"
> >             },
> >             {
> >               "Worker Number": 1,
> >               "Sort Method": "external merge",
> >               "Sort Space Used": 73320,
> >               "Sort Space Type": "Disk"
> >             }
> >           ],
> >           "Workers": [
> >             {
> >               "Worker Number": 0,
> >               "Actual Startup Time": 1487.846,
> >               "Actual Total Time": 1996.879,
> >               "Actual Rows": 2692973,
> >               "Actual Loops": 1
> >             },
> >             {
> >               "Worker Number": 1,
> >               "Actual Startup Time": 1468.256,
> >               "Actual Total Time": 2012.744,
> >               "Actual Rows": 2684443,
> >               "Actual Loops": 1
> >             }
> >           ],  
> 
> Yes, that's really awful.
> 
> 
> ...
> 
> 
> > I think that the text format should stay as is.
> >
> > For the JSON format however it would be better in my opinion if
> > "Workers" data is merged. Parsing should not imply anything else than
> > "var myObj = JSON.parse(theJsonString);".
> >
> > What do you think?

Please, find in attachment a patch that merge parallel data together.

Note that duplicated keys are discouraged in json specs, but they are forbidden
in yaml ones. See link in the commit message.

Regards,

Attachment

pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: RE: [Proposal] Level4 Warnings show many shadow vars
Next
From: Tomas Vondra
Date:
Subject: Re: Using multiple extended statistics for estimates