From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | TJ O'Donnell <tjo(at)acm(dot)org> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: unique rows |
Date: | 2006-09-27 20:27:46 |
Message-ID: | 20060927202746.GA9702@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Wed, Sep 20, 2006 at 22:18:04 -0700,
TJ O'Donnell <tjo(at)acm(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | tomcask o_o | 2006-09-28 22:37:56 | files or DataBase |
Previous Message | Markus Schaber | 2006-09-27 14:33:02 | Re: Query regarding Writing a report using the file sysstem |