pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: Laurent Martelli <laurent@aopsys.com>
Cc: PFC <lists@boutiquenumerique.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Speeding up select distinct
Date: 16 Mar 2005 21:29:13 -0500
Message-ID: <87ekefj98m.fsf@stark.xeocode.com> (raw)
In-Reply-To: <87fyyv4f6l.fsf@stan.aopsys>
References: <87k6o74gms.fsf@stan.aopsys>
	<opsnqsmjvlth1vuj@localhost>
	<87fyyv4f6l.fsf@stan.aopsys>

Laurent Martelli <laurent@aopsys.com> writes:

>   PFC> 	SELECT owner from pictures group by owner;
> 
> That's a slight improvement, but there's still a seq scan on pictures:

It should be a sequential scan. An index will be slower.

>  HashAggregate  (cost=114.38..114.38 rows=21 width=4) (actual time=7.585..7.605 rows=21 loops=1)
>    ->  Seq Scan on pictures  (cost=0.00..103.70 rows=4270 width=4) (actual time=0.015..3.272 rows=4270 loops=1)
>  Total runtime: 7.719 ms

That's the best plan for this query.

-- 
greg




view thread (10+ messages)

Message-ID: <87ekefj98m.fsf@stark.xeocode.com>
Permalink:  ../87ekefj98m.fsf@stark.xeocode.com/
Also on:    postgresql.org/message-id/87ekefj98m.fsf@stark.xeocode.com

 · 

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-performance@postgresql.org
  Cc: gsstark@mit.edu, laurent@aopsys.com, lists@boutiquenumerique.com
  Subject: Re: Speeding up select distinct
  In-Reply-To: <87ekefj98m.fsf@stark.xeocode.com>

* 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