SELECT DISTINCT very slow

From: Ben Harper <rogojin(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: SELECT DISTINCT very slow
Date: 2009-07-09 15:09:13
Message-ID: 6def3e7b0907090809w3b498199mc98308b6984898c4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Barnes 2009-07-09 15:15:24 Asking for assistance in determining storage requirements
Previous Message Paolo Saudin 2009-07-09 15:00:33 PostgreSQL 8.4 Window functions