Re: Index not used on group by - Mailing list pgsql-performance

From Richard Huxton
Subject Re: Index not used on group by
Date
Msg-id 4339236F.7070403@archonet.com
Whole thread Raw
In response to Index not used on group by  (Andrey Repko <repko@sart.must-ipra.com>)
Responses Re: Index not used on group by
List 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

pgsql-performance by date:

Previous
From: Gnanavel S
Date:
Subject: PostgreSQL overall design
Next
From: Андрей Репко
Date:
Subject: Re: Index not used on group by