pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vlad Marchenko <vlad@infonet.com.ua>
To: pgsql-sql@postgresql.org
Subject: "Group by" and "index".
Date: Sun, 30 Jan 2000 23:01:23 +0200
Message-ID: <004c01bf6b65$2c0d47c0$2d7a01d4@kuzja> (raw)

Hi,

PostgreSQL 6.5.3.

I've created the following index:

>create index test_index on test (filed1);
>vacuum;

And then:

>explain select field1 from test group by field1;
NOTICE:  QUERY PLAN:

Group  (cost=2510.40 rows=58709 width=12)
  ->  Sort  (cost=2510.40 rows=58709 width=12)
        ->  Seq Scan on test  (cost=2510.40 rows=58709 width=12)

It don't use this index :-(. I've tried to create two types of index:
b-tree and hash - both doesn't work until "group" is present. If I type

> explain select field1 from test where field1='tra-ta-ta';

NOTICE:  QUERY PLAN:

Index Scan using test_index on test (cost=2.05 rows=2 width=12)


It work this way.


Any ideas?

_____________
Vlad Marchenko




view thread (3+ messages)  latest in thread

Message-ID: <004c01bf6b65$2c0d47c0$2d7a01d4@kuzja>
Permalink:  ../004c01bf6b65$2c0d47c0$2d7a01d4@kuzja/
Also on:    postgresql.org/message-id/004c01bf6b65$2c0d47c0$2d7a01d4@kuzja

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: vlad@infonet.com.ua
  Subject: Re: "Group by" and "index".
  In-Reply-To: <004c01bf6b65$2c0d47c0$2d7a01d4@kuzja>
  References: <004c01bf6b65$2c0d47c0$2d7a01d4@kuzja>

* 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