From: Bruno Wolff III <bruno@wolff.to>
To: TJ O'Donnell <tjo@acm.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: unique rows
Date: Wed, 27 Sep 2006 15:27:46 -0500
Message-ID: <20060927202746.GA9702@wolff.to> (raw)
In-Reply-To: <4512208C.9050607@acm.org>
References: <4512208C.9050607@acm.org>
On Wed, Sep 20, 2006 at 22:18:04 -0700,
TJ O'Donnell <tjo@acm.org> wrote:
> I want to make a table that has unique rows - no problem.
> Create Table x (smarts Varchar Unique);
>
> I have input data that has many duplicates and until now
> I was creating a temp table allowing duplicates, and then
> Insert into x (smarts) select distinct smarts from tmpx;
> This is now failing when I have hundreds of millions of
> rows, running out of temp space (while trying to sort to
> accomplish the distinct?)
Another option would be to do a select with a GROUP BY instead of DISTINCT.
That would allow for a hash aggregate plan (don't forget to analyse the
temp table first) which would use less memory.
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, tjo@acm.org
Subject: Re: unique rows
In-Reply-To: <20060927202746.GA9702@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