pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marcos Garcia <marcos-p-garcia@ptinovacao.pt>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Slow SELECT with distinct, in a TIMESTAMP type column
Date: 24 Jun 2002 20:46:15 +0100
Message-ID: <1024947975.1035.648.camel@sargao> (raw)
In-Reply-To: <20020624113546.R56100-100000@megazone23.bigpanda.com>
References: <20020624113546.R56100-100000@megazone23.bigpanda.com>


When i make the set enable_seqscan = off the result is:

dbname=# set enable_seqscan = off;
SET VARIABLE
dbname=# explain analyze SELECT distinct(smsdate) FROM send_total;

NOTICE:  QUERY PLAN:

Unique  (cost=0.00..31084.39 rows=1232 width=8) (actual
time=108.60..195210.91 rows=6676 loops=1)
  ->  Index Scan using send_total_smsdate_idx on send_total 
(cost=0.00..31053.60 rows=12315 width=8) (actual time=108.59..195145.43
rows=12087 loops=1)
Total runtime: 195226.24 msec




On Mon, 2002-06-24 at 19:36, Stephan Szabo wrote:
> 
> 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?
> 
-- 
M.P.Garcia
PT Inovação, SA
Serviços e Redes Móveis 
Rua José Ferreira Pinto Basto - 3810 Aveiro
Tel: 234 403 253  -  Fax: 234 424 160
E-mail: marcos-p-garcia@ptinovacao.pt

Attachments:

  signature.asc (application/pgp-signature, 231B) download

view thread (4+ messages)  latest in thread

Message-ID: <1024947975.1035.648.camel@sargao>
Permalink:  ../1024947975.1035.648.camel@sargao/
Also on:    postgresql.org/message-id/1024947975.1035.648.camel@sargao

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: marcos-p-garcia@ptinovacao.pt, sszabo@megazone23.bigpanda.com
  Subject: Re: Slow SELECT with distinct, in a TIMESTAMP type column
  In-Reply-To: <1024947975.1035.648.camel@sargao>

* 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