From: | Scara Maccai <m_lists(at)yahoo(dot)it> |
---|---|
To: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Clustering with enough work_mem: copy heap in mem? |
Date: | 2009-08-20 14:46:50 |
Message-ID: | 676587.27600.qm@web24615.mail.ird.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 the heap 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 foreign key to the table you're clustering, I guess the "create as" method doesn't work (I guess you can't drop a table that is the foreign key of another one).
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2009-08-20 14:48:24 | Re: Clustering with enough work_mem: copy heap in mem? |
Previous Message | Scott Marlowe | 2009-08-20 14:35:25 | Re: Clustering with enough work_mem: copy heap in mem? |