Skip site navigation (1) Skip section navigation (2)

Re: Invalid YAML output from EXPLAIN

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Invalid YAML output from EXPLAIN
Date: 2010-06-09 19:38:10
Message-ID: AANLkTim4sNkHELcgYYrtVOflfIJb4hnQTZGX0At_vMJ7@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
On 9 June 2010 19:50, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> After thinking about this further, I think I'd still like to take one
> more crack at fixing this without quoting absolutely everything.  I
> argued against this feature, but we decided to take it, and it seems
> that one of the major arguments that is being put forward is that it
> will be more readable than JSON, because it will have less
> punctuation.

Hmm. Well it's quite subjective, but IMO it's already more readable
than JSON regardless of whether or not values are quoted, simply
because it doesn't have [ ] and { } for lists and maps, which for JSON
adds significantly to the number of lines in longer plans.

Compare

               QUERY PLAN
----------------------------------------
 - Plan:                               +
     Node Type: Nested Loop            +
     Join Type: Inner                  +
     Startup Cost: 0.00                +
     Total Cost: 57313.15              +
     Plan Rows: 4579600                +
     Plan Width: 16                    +
     Plans:                            +
       - Node Type: Seq Scan           +
         Parent Relationship: Outer    +
         Relation Name: foo            +
         Alias: f1                     +
         Startup Cost: 0.00            +
         Total Cost: 31.40             +
         Plan Rows: 2140               +
         Plan Width: 8                 +
       - Node Type: Materialize        +
         Parent Relationship: Inner    +
         Startup Cost: 0.00            +
         Total Cost: 42.10             +
         Plan Rows: 2140               +
         Plan Width: 8                 +
         Plans:                        +
           - Node Type: Seq Scan       +
             Parent Relationship: Outer+
             Relation Name: foo        +
             Alias: f2                 +
             Startup Cost: 0.00        +
             Total Cost: 31.40         +
             Plan Rows: 2140           +
             Plan Width: 8

with
                  QUERY PLAN
-----------------------------------------------
 [                                            +
   {                                          +
     "Plan": {                                +
       "Node Type": "Nested Loop",            +
       "Join Type": "Inner",                  +
       "Startup Cost": 0.00,                  +
       "Total Cost": 57313.15,                +
       "Plan Rows": 4579600,                  +
       "Plan Width": 16,                      +
       "Plans": [                             +
         {                                    +
           "Node Type": "Seq Scan",           +
           "Parent Relationship": "Outer",    +
           "Relation Name": "foo",            +
           "Alias": "f1",                     +
           "Startup Cost": 0.00,              +
           "Total Cost": 31.40,               +
           "Plan Rows": 2140,                 +
           "Plan Width": 8                    +
         },                                   +
         {                                    +
           "Node Type": "Materialize",        +
           "Parent Relationship": "Inner",    +
           "Startup Cost": 0.00,              +
           "Total Cost": 42.10,               +
           "Plan Rows": 2140,                 +
           "Plan Width": 8,                   +
           "Plans": [                         +
             {                                +
               "Node Type": "Seq Scan",       +
               "Parent Relationship": "Outer",+
               "Relation Name": "foo",        +
               "Alias": "f2",                 +
               "Startup Cost": 0.00,          +
               "Total Cost": 31.40,           +
               "Plan Rows": 2140,             +
               "Plan Width": 8                +
             }                                +
           ]                                  +
         }                                    +
       ]                                      +
     }                                        +
   }                                          +
 ]

For me, the presence or absence of quotes around the values would make
little difference to the readability, compared to all those brackets.



> While the idea of optimizing a machine-readable format
> for human-readability doesn't typically carry much water around here,
> it's really the only use case for having this particular feature at
> all, so, if we're not going to rip it out, ISTM we ought to respect
> what it's there for.  I would be more than willing to agree that if
> one more attempt isn't sufficient to fix the problem then we'll either
> quote everything, or rip the whole thing out.
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise Postgres Company
>

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-06-09 19:47:55
Subject: Re: No hash join across partitioned tables?
Previous:From: Robert HaasDate: 2010-06-09 19:32:58
Subject: Re: failover vs. read only queries

pgsql-bugs by date

Next:From: Tom LaneDate: 2010-06-09 19:50:47
Subject: Re: Invalid YAML output from EXPLAIN
Previous:From: Kevin GrittnerDate: 2010-06-09 18:56:13
Subject: Re: BUG #5495: RI/FK on self and inherited table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group