On Wed, Sep 20, 2006 at 22:18:04 -0700, TJ O'Donnell <[EMAIL PROTECTED]> 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. ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org