Couple of days ago RhodiumToad reported, on irc, a bug in explain.depesz.com.
Specifically – if explain was done using JSON/XML/YAML formats, and node type was Aggregate, the site didn't extract full info.
In text explains the node type is one of:
But in non-text formats, type of Aggregate was ignored.
As of now, and version 0.92 of Pg::Explain library, Aggregate types are correctly extracted.
You can see it in four tests in here:
|Test #||TEXT||JSON||XML||YAML||Query example|
SELECT COUNT(*) FROM pg_class;
SELECT relkind, COUNT(*) FROM pg_class GROUP BY 1;
WITH x AS (SELECT relkind FROM pg_class ORDER BY relkind) SELECT relkind, COUNT(*) FROM x GROUP BY relkind;
SELECT relnamespace, relkind, COUNT(*) FROM pg_class GROUP BY 1, 2;
Hope it helps.
2 thoughts on “Fix for displaying aggregates on explain.depesz.com”
The fix is unfortunately incomplete, it’s not handling MixedAggregate. A sample query:
select a,count(*) from (values (1)) v(a) group by rollup(a);
Fixed for json/yaml: https://explain.depesz.com/s/99qr
XML is a bit harder, and with more examples, with more group/hash keys i can’t realistically do it.
Comments are closed.