pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Korisk <Korisk@yandex.ru>
To: pgsql-performance@postgresql.org
Subject: hash aggregation
Date: Wed, 10 Oct 2012 20:09:02 +0400
Message-ID: <118871349885342@web16f.yandex.ru> (raw)

Hello! Is it possible to speed up the plan? 

hashes=# \d hashcheck
                              Table "public.hashcheck"
 Column |       Type        |                       Modifiers                        
--------+-------------------+--------------------------------------------------------
 id     | integer           | not null default nextval('hashcheck_id_seq'::regclass)
 name   | character varying | 
 value  | character varying | 
Indexes:
    "btr" btree (name)

hashes=# select version();
                                                   version                                                    
--------------------------------------------------------------------------------------------------------------
 PostgreSQL 9.2.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2), 64-bit
(1 row)

hashes=# explain analyse verbose select name, count(name) as cnt from hashcheck group by name order by name desc;
                                                                 QUERY PLAN                                                               
   
---------------------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=573977.88..573978.38 rows=200 width=32) (actual time=10351.280..10351.551 rows=4000 loops=1)
   Output: name, (count(name))
   Sort Key: hashcheck.name
   Sort Method: quicksort  Memory: 315kB
   ->  HashAggregate  (cost=573968.24..573970.24 rows=200 width=32) (actual time=10340.507..10341.288 rows=4000 loops=1)
         Output: name, count(name)
         ->  Seq Scan on public.hashcheck  (cost=0.00..447669.16 rows=25259816 width=32) (actual time=0.019..2798.058 rows=25259817 loops=1)
               Output: id, name, value
 Total runtime: 10351.989 ms
(9 rows)

hashes=# 

Thank you.




view thread (15+ messages)  latest in thread

Message-ID: <118871349885342@web16f.yandex.ru>
Permalink:  ../118871349885342@web16f.yandex.ru/
Also on:    postgresql.org/message-id/118871349885342@web16f.yandex.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: Korisk@yandex.ru
  Subject: Re: hash aggregation
  In-Reply-To: <118871349885342@web16f.yandex.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox