Re: Clustering with enough work_mem: copy heap in mem? - Mailing list pgsql-general

From Scara Maccai
Subject Re: Clustering with enough work_mem: copy heap in mem?
Date
Msg-id 676587.27600.qm@web24615.mail.ird.yahoo.com
Whole thread Raw
In response to Re: Clustering with enough work_mem: copy heap in mem?  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
> I've found it easier to select everything into another
> table, truncate
> the original table, then insert the rows as:

that takes 50 seconds of pure sorting and 8GB of ram to sort; my method doesn't require more memory than the size of
theheap table, and no sorting, since the index is already sorted. Basically the cluster operation would be: 

A) time it takes to do a full scan of the heap
+ B) time it takes to do a full scan of the index
+ C) time it takes to rewrite ordered heap and index

of course C) is no different than any other method I guess.

plus: with the "create as" method indexes, foreign keys etc have to be recreated on the tab (I'm not talking about
timing:it's just that you have to "remember" to re-create whatever was in the old table...). Plus: if a table has a
foreignkey to the table you're clustering, I guess the "create as" method doesn't work (I guess you can't drop a table
thatis the foreign key of another one). 







pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Clustering with enough work_mem: copy heap in mem?
Next
From: Alvaro Herrera
Date:
Subject: Re: Clustering with enough work_mem: copy heap in mem?