Обсуждение: Non-text EXPLAIN output for partial aggregation

Поиск
Список
Период
Сортировка

Non-text EXPLAIN output for partial aggregation

От
Tom Lane
Дата:
I noticed that the EXPLAIN code is set up so that in non-text output
modes, you get output like this for partial-aggregate plans:
      "Node Type": "Aggregate",                  +      "Strategy": "Plain",                       +      "Operation":
"Finalize",                  +
 
...              "Node Type": "Aggregate",          +              "Strategy": "Plain",               +
"Operation":"Partial",            +
 

That is, the "Operation" field type has been commandeered to indicate
partial-aggregation cases.  This seems like a pretty bad idea to me,
for two reasons:

1.  In other plan node types, "Operation" refers to SQL-visible semantics,
in fact always Select/Insert/Update/Delete.  Re-using it for an
implementation detail doesn't seem very consistent.

2.  As coded, the field is not printed at all for a non-partial aggregate
node.  This is just wrong.  A given node type should have a fixed set of
attributes.

I think we should use some other field name, maybe "Step" or
"PartialMode", and have "Simple" or "Plain" as the default field
contents.  It's also arguable that this field should distinguish all the
values of the AggSplit enum we just invented, though I'm not sure how
important it is to report serialization options.  I'm not wedded to any
particular ideas here, other than that omitting the field in the simple
case is bad.

Comments, naming ideas?
        regards, tom lane



Re: Non-text EXPLAIN output for partial aggregation

От
Robert Haas
Дата:
On Sun, Jun 26, 2016 at 4:25 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I noticed that the EXPLAIN code is set up so that in non-text output
> modes, you get output like this for partial-aggregate plans:
>
>        "Node Type": "Aggregate",                  +
>        "Strategy": "Plain",                       +
>        "Operation": "Finalize",                   +
> ...
>                "Node Type": "Aggregate",          +
>                "Strategy": "Plain",               +
>                "Operation": "Partial",            +
>
> That is, the "Operation" field type has been commandeered to indicate
> partial-aggregation cases.  This seems like a pretty bad idea to me,
> for two reasons:
>
> 1.  In other plan node types, "Operation" refers to SQL-visible semantics,
> in fact always Select/Insert/Update/Delete.  Re-using it for an
> implementation detail doesn't seem very consistent.
>
> 2.  As coded, the field is not printed at all for a non-partial aggregate
> node.  This is just wrong.  A given node type should have a fixed set of
> attributes.
>
> I think we should use some other field name, maybe "Step" or
> "PartialMode", and have "Simple" or "Plain" as the default field
> contents.  It's also arguable that this field should distinguish all the
> values of the AggSplit enum we just invented, though I'm not sure how
> important it is to report serialization options.  I'm not wedded to any
> particular ideas here, other than that omitting the field in the simple
> case is bad.
>
> Comments, naming ideas?

Simple sounds better than Plain, as between the two of them, because
Plain already means something with respect to aggregates.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company