Search Postgresql Archives

Re: Can somebody explain what is the meaning for HashAggregate?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 20 Sep 2015 21:56:39 +0800 (CST)
lin <jluwln@xxxxxxx> wrote:

> Can somebody explain what does the postgres done for the explain of sql shows HashAggregate( what is the meaning for  HashAggregate  )?
> for example: 
> 
> 
> postgres=# explain verbose select oid,relname  from pg_class group by oid,relname;
>                                  QUERY PLAN                                  
> -----------------------------------------------------------------------------
>  HashAggregate  (cost=12.42..15.38 rows=295 width=68)
>    Output: oid, relname
>    Group Key: pg_class.oid, pg_class.relname
>    ->  Seq Scan on pg_catalog.pg_class  (cost=0.00..10.95 rows=295 width=68)
>          Output: oid, relname
> (5 rows)
> 
> 
> ::  first, seq scan pg_class and return (oid,relname);
>    second,  make group (oid,relname),  is it fisrt sort by oid then in the oid group sort by relname?
> Can somebody explain what does the database done for hashAggregate?

It combines the values for oid and relname for each returned row, generates a hashkey
for them, then uses that hashkey to aggregate (compute the GROUP BY, essentially, in
this case)

-- 
Bill Moran


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux