Re: tuplesort memory usage: grow_memtuples - Mailing list pgsql-hackers

From Jeff Janes
Subject Re: tuplesort memory usage: grow_memtuples
Date
Msg-id CAMkU=1ysbtOQkYYuzqM=ghFnTj=Vmy9am2m=L1Y=8vWUPmowMQ@mail.gmail.com
Whole thread Raw
In response to Re: tuplesort memory usage: grow_memtuples  (Peter Geoghegan <peter@2ndquadrant.com>)
List pgsql-hackers
On Thu, Aug 16, 2012 at 4:26 PM, Peter Geoghegan <peter@2ndquadrant.com> wrote:
> On 27 July 2012 16:39, Jeff Janes <jeff.janes@gmail.com> wrote:
>>> Can you suggest a benchmark that will usefully exercise this patch?
>>
>> I think the given sizes below work on most 64 bit machines.
>
> My apologies for not getting around to taking a look at this sooner.
>
...
>
> I have attached a revision for your consideration, with a few
> editorialisations, mostly style-related.

Sorry, this fell through the cracks.  Your proposed patch looks good.


...

> I think this patch (or at least your observation about I/O waits
> within vmstat) may point to a more fundamental issue with our sort
> code: Why are we not using asynchronous I/O in our implementation?

I only see a lot of io waits when using a small value of work_mem.
And I don't know how useful async would be there, as where would we
stash the read-ahead data with work_mem being so small?  At larger
sizes, the kernel or raid controller automatic read ahead seems to be
enough to saturate a CPU.

Maybe just giving more aggressive advice about the default value of
work_mem being quite low for modern hardware, or making it scale with
shared_buffers by default similar to the way wal_buffers now does,
would be sufficient.

Cheers,

Jeff



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: pg_stat_lwlocks view - lwlocks statistics, round 2
Next
From: Simon Riggs
Date:
Subject: Re: tuplesort memory usage: grow_memtuples