Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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


pgsql-performance by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group