group by of multi columns

From: Flyingfox Lee <flyingfoxlee(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: group by of multi columns
Date: 2015-01-04 08:12:08
Message-ID: CAJ0dLtDDs+xes7z_KB4-KvF2CaoBV5iLqgbP-hJ4y=g2GODR-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am doing a `group by` on a table with ~ 3 million rows, the code is
simply `select A, B, C, D,E count(1) from t group by A, B, C, D, E order by
6`, it takes ~ 3 minutes for this operation and there are ~ 500 rows
returned. So, to speed this up, should I add a composite index on A, B, C,
D, E or there are some parameters in postgresql.conf I can tweak, I am new
to postgres, all the parameters in postgresql.conf are the default.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rafal Pietrak 2015-01-04 08:40:21 Re: partial "on-delete set null" constraint
Previous Message Alban Hertroys 2015-01-04 01:02:44 Re: partial "on-delete set null" constraint