| From: | Bill Moran <wmoran(at)potentialtech(dot)com> |
|---|---|
| To: | Ben Harper <rogojin(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: SELECT DISTINCT very slow |
| Date: | 2009-07-09 15:25:21 |
| Message-ID: | 20090709112521.ded0391e.wmoran@potentialtech.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
In response to Ben Harper <rogojin(at)gmail(dot)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.
What's the output of EXPLAIN ANALYZE SELECT DISTINCT field FROM table;?
Does a VACUUM ANALYZE of the table help? Is the query significantly
faster the second time you run it?
> Is this a well known issue?
Not that I'm aware of.
--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2009-07-09 15:47:38 | Re: SELECT DISTINCT very slow |
| Previous Message | Chris Barnes | 2009-07-09 15:15:24 | Asking for assistance in determining storage requirements |