Re: Slow SELECT with distinct, in a TIMESTAMP type column

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Marcos Garcia <marcos-p-garcia(at)ptinovacao(dot)pt>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Slow SELECT with distinct, in a TIMESTAMP type column
Date: 2002-06-24 18:36:56
Message-ID: 20020624113546.R56100-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On 24 Jun 2002, Marcos Garcia wrote:

> The problem is that my query is too slow when i use distinct:
>
> pgsql> explain analyze SELECT distinct(smsdate) FROM send_total;
>
> NOTICE: QUERY PLAN:
>
> Unique (cost=15840.31..15870.81 rows=1220 width=8) (actual
> time=56358.93..56452.78 rows=6670 loops=1)
> -> Sort (cost=15840.31..15840.31 rows=12203 width=8) (actual
> time=56358.91..56436.95 rows=12062 loops=1)
> -> Seq Scan on send_total (cost=0.00..15012.03 rows=12203
> width=8) (actual time=0.55..56205.25 rows=12062 loops=1)
> Total runtime: 56518.26 msec

As a question, what does explain analyze show if you
set enable_seqscan=off; first?

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Marcos Garcia 2002-06-24 19:46:15 Re: Slow SELECT with distinct, in a TIMESTAMP type column
Previous Message Jeff Eckermann 2002-06-24 18:06:18 Re: assign count() result to a declared variable in plpgsql