From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "Simon Riggs" <simon(at)2ndquadrant(dot)com> |
Cc: | "PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: possible minor EXPLAIN bug? |
Date: | 2008-08-19 09:24:24 |
Message-ID: | 162867790808190224w3856df45ybe77c61d7bdc56c5@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2008/8/19 Simon Riggs <simon(at)2ndquadrant(dot)com>:
>
> On Tue, 2008-08-19 at 09:45 +0200, Pavel Stehule wrote:
>
>> postgres=# explain select sum(a) from twocol group by b;
>> QUERY PLAN
>> ----------------------------------------------------------------
>> HashAggregate (cost=42.10..44.60 rows=200 width=8) --< wrong should be 4
>> -> Seq Scan on twocol (cost=0.00..31.40 rows=2140 width=8)
>> (2 rows)
>
> Although column b is not displayed it is kept in the HashAgg node to
> allow your request to GROUP BY B. I'm happy that it tells me the width
> of 8 so I can work out space used by hash, but perhaps it should say 12
> (or even 16) to include hash value also, so we include the full cost per
> row in the hash table.
>
> If you do
> explain select sum(a) from twocol
> you will see the width is only 4
yes, Agg get this value directly, but it wrong
postgres=# explain select * from (select sum(a) from twocol group by b
offset 0) c;
QUERY PLAN
----------------------------------------------------------------------------
Subquery Scan c (cost=42.10..46.60 rows=200 width=8)
-> Limit (cost=42.10..44.60 rows=200 width=8)
-> HashAggregate (cost=42.10..44.60 rows=200 width=8)
-> Seq Scan on twocol (cost=0.00..31.40 rows=2140 width=8)
(4 rows)
limit, subquery scan has wrong width now.
regards
Pavel
>
> --
> Simon Riggs www.2ndQuadrant.com
> PostgreSQL Training, Services and Support
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2008-08-19 09:25:21 | Re: Overhauling GUCS |
Previous Message | Michael Nacos | 2008-08-19 09:16:20 | Auto-tuning GUCS |