pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Андрей Репко <repko@sart.must-ipra.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Index not used on group by
Date: Tue, 27 Sep 2005 11:48:15 +0100
Message-ID: <4339236F.7070403@archonet.com> (raw)
In-Reply-To: <144520928.20050927121431@sart.must-ipra.com>
References: <144520928.20050927121431@sart.must-ipra.com>

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



view thread (6+ messages)  latest in thread

Message-ID: <4339236F.7070403@archonet.com>
Permalink:  ../4339236F.7070403@archonet.com/
Also on:    postgresql.org/message-id/4339236F.7070403@archonet.com

 · 

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: dev@archonet.com, repko@sart.must-ipra.com
  Subject: Re: Index not used on group by
  In-Reply-To: <4339236F.7070403@archonet.com>

* 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