Re: SELECT DISTINCT very slow - Mailing list pgsql-general

From Pavel Stehule
Subject Re: SELECT DISTINCT very slow
Date
Msg-id 162867790907090856s347ede5bl8dfceec3ec9d933c@mail.gmail.com
Whole thread Raw
In response to SELECT DISTINCT very slow  (Ben Harper <rogojin@gmail.com>)
List pgsql-general
Hello

when you use older pg than 8.3, please, use GROUP BY.

SELECT field FROM table GROUP BY field.

Regards
Pavel Stehule

2009/7/9 Ben Harper <rogojin@gmail.com>:
> Hi,
> Can anybody explain this:
>
> Records: 600,000
> Field Width: Approximately 20 UTF8 characters - type is VARCHAR(25)
> Field is Indexed.
>
> SELECT DISTINCT field FROM table;
>
> Takes about 6 seconds. There are 111 distinct items.
>
> On Sqlite, and another place where I have a B+Tree, this query is
> faster than my eye can measure.
>
> Is this a well known issue?
>
> Thanks,
> Ben
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

pgsql-general by date:

Previous
From: Andres Freund
Date:
Subject: Re: SELECT DISTINCT very slow
Next
From: Dan Armbrust
Date:
Subject: Re: Checkpoint Tuning Question