Re: unique rows - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: unique rows
Date
Msg-id 20060927202746.GA9702@wolff.to
Whole thread Raw
In response to unique rows  (TJ O'Donnell <tjo@acm.org>)
List pgsql-sql
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.


pgsql-sql by date:

Previous
From: Markus Schaber
Date:
Subject: Re: Query regarding Writing a report using the file sysstem
Next
From: "tomcask o_o"
Date:
Subject: files or DataBase