Re: Clustering with enough work_mem: copy heap in mem?

From: Scara Maccai <m_lists(at)yahoo(dot)it>
To: Alvaro Herrera <alvherre(at)commandprompt(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 15:07:47
Message-ID: 65654.5083.qm@web24603.mail.ird.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> There was an
> attempt to fix it (for example so that it could try to do a
> seqscan+sort
> instead of indexscan), but it stalled.

Actually I read that, but it's complicated... it involves planning and a lot of other stuff I don't even know about...

My "solution" I guess would be easier (but, of course, can't be used if you don't have enough work_mem):

if heap table <= work_mem
copy heap table in mem
use that region as it was the real file
else
do the regular (slow!) cluster

I guess this can be worse than the current way of doing it only when the table contains a lot of dead rows; in all other cases I can't see how cluster could ever become faster than a simple table + index scans.

Of course, I'm not saying it's "very easy" to implement... but given the tons of ram a lot of people use in the servers, and the fact that work_mem can be set on a per-connection basis, I think it would be nice...

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2009-08-20 15:23:41 Re: Monitoring the sequence cycles
Previous Message Alvaro Herrera 2009-08-20 14:48:24 Re: Clustering with enough work_mem: copy heap in mem?