pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Max Baker <max@warped.org>
To: Chad Thompson <chad@weblinkservices.com>
Cc: PostgreSQL Performance Mailing List <pgsql-performance@postgresql.org>
Subject: Re: speeding up COUNT and DISTINCT queries
Date: Wed, 12 Mar 2003 17:00:19 -0800
Message-ID: <20030313010018.GN30411@warped.org> (raw)
In-Reply-To: <0ca601c2e8ea$6f7783d0$32021aac@chad>
References: <20030312223811.GM30411@warped.org>
	<0ca601c2e8ea$6f7783d0$32021aac@chad>

On Wed, Mar 12, 2003 at 03:55:09PM -0700, Chad Thompson wrote:
> Ive found that group by works faster than distinct.
> 
> Try
> EXPLAIN ANALYZE  select mac from node group by mac;

This was about 25% faster, thanks!

That will work for distinct() only calls, but I still am looking for a
way to speed up the count() command.  Maybe an internal counter of rows,
and  triggers?

-m



view thread (14+ messages)  latest in thread

Message-ID: <20030313010018.GN30411@warped.org>
Permalink:  ../20030313010018.GN30411@warped.org/
Also on:    postgresql.org/message-id/20030313010018.GN30411@warped.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: max@warped.org, chad@weblinkservices.com
  Subject: Re: speeding up COUNT and DISTINCT queries
  In-Reply-To: <20030313010018.GN30411@warped.org>
  References: <20030312223811.GM30411@warped.org> <0ca601c2e8ea$6f7783d0$32021aac@chad> <20030313010018.GN30411@warped.org>

* 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