Re: Memory usage during sorting - Mailing list pgsql-hackers

From Hitoshi Harada
Subject Re: Memory usage during sorting
Date
Msg-id CAP7QgmmWGyi_ZKZpGRYQRVYcxx1eZ8sO3up2h01HFzoFjP-OOg@mail.gmail.com
Whole thread Raw
In response to Memory usage during sorting  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: Memory usage during sorting  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-hackers
On Sun, Jan 15, 2012 at 4:59 PM, Jeff Janes <jeff.janes@gmail.com> wrote:
>
> The attached patch allows it to reuse that memory.  On my meager
> system it reduced the building of an index on an integer column in a
> skinny 200 million row totally randomly ordered table by about 3% from
> a baseline of 25 minutes.
>

Just to give a standard review, this patch is one line change and
applies cleanly, builds ok.

I'm not pretty sure what exactly you're trying to accomplish, but it
seems to me that it's avoiding the first dumptuples cycle by forcing
availMem = 0 even if it's negative. I read your comments as it'd be
avoiding to alternate reading/writing back and force with scattered
memory failing memory cache much during merge phase, but actually it
doesn't affect merge phase but only init-dump phase, does it? If so,
I'm not so convinced your benchmark gave 3 % gain by this change.
Correct me as I'm probably wrong.

Anyway, it's nice to modify the comment just above the change, since
it's now true with it.

Thanks,
--
Hitoshi Harada


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: controlling the location of server-side SSL files
Next
From: Hitoshi Harada
Date:
Subject: Re: Memory usage during sorting