Re: Index not used on group by

From: Richard Huxton <dev(at)archonet(dot)com>
To: Андрей Репко <repko(at)sart(dot)must-ipra(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Index not used on group by
Date: 2005-09-27 10:48:15
Message-ID: 4339236F.7070403@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Andrey Repko wrote:
>
> I have table ma_data, that contain above 300000 rows.
> This table has primary key id, and field alias_id.
> I create index (btree)on this field.
> Set statistic:
>
> ALTER TABLE "public"."ma_data"
> ALTER COLUMN "alias_id" SET STATISTICS 998;
>
> So, when I do something like
> SELECT alias_id FROM ma_data GROUP BY alias_id

Why are you using GROUP BY without any aggregate functions?

What happens if you use something like
SELECT DISTINCT alias_id FROM ma_data;

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Sean Davis 2005-09-27 10:54:51 Re: Index use in BETWEEN statement...
Previous Message Abhijit Menon-Sen 2005-09-27 10:27:01 Re: PostgreSQL overall design