From: Bruno Wolff III <bruno@wolff.to>
To: Michael Contzen <Michael.Contzen@dohle.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How slow is distinct - 2nd
Date: Fri, 4 Oct 2002 10:31:08 -0500
Message-ID: <20021004153108.GA14180@wolff.to> (raw)
In-Reply-To: <NFBBLKLMPMLOHOLPGAFPIEMFCAAA.Michael Contzen@Dohle.com>
References: <NFBBLKLMPMLOHOLPGAFPIEMFCAAA.Michael Contzen@Dohle.com>
On Tue, Oct 01, 2002 at 14:18:50 +0200,
Michael Contzen <Michael.Contzen@dohle.com> wrote:
> Here the table:
>
> mc=# \d egal
> Table "public.egal"
> Column | Type | Modifiers
> --------+---------+-----------
> i | integer |
>
> mc=# select count(*) from egal;
> count
> ---------
> 7227744
> (1 row)
>
> mc=# select count(distinct i) from egal;
> count
> -------
> 67
> (1 row)
This suggests that the best way to do this is with a hash instead of a sort.
If you have lots of memory you might try increasing the sort memory size.
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: bruno@wolff.to, Michael.Contzen@dohle.com
Subject: Re: How slow is distinct - 2nd
In-Reply-To: <20021004153108.GA14180@wolff.to>
* 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