Re: Explain: Duplicate key "Workers" in JSON format

From: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>
To: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
Cc: Pierre Giraud <pierre(dot)giraud(at)dalibo(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Explain: Duplicate key "Workers" in JSON format
Date: 2019-12-05 16:59:52
Message-ID: 20191205175952.7e6f0555@firost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

On Fri, 23 Aug 2019 09:30:59 -0400
Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)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 Content-Type Size
0001-Merge-parallel-infos-for-each-worker-in-explain.patch text/x-patch 4.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2019-12-05 17:15:54 Re: Using multiple extended statistics for estimates
Previous Message Ranier Vilela 2019-12-05 16:26:32 RE: [Proposal] Level4 Warnings show many shadow vars