Re: tuplesort memory usage: grow_memtuples

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tuplesort memory usage: grow_memtuples
Date: 2012-10-14 05:22:54
Message-ID: CAMkU=1ysbtOQkYYuzqM=ghFnTj=Vmy9am2m=L1Y=8vWUPmowMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 16, 2012 at 4:26 PM, Peter Geoghegan <peter(at)2ndquadrant(dot)com> wrote:
> On 27 July 2012 16:39, Jeff Janes <jeff(dot)janes(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Law 2012-10-14 06:35:04 Re: BUG #6510: A simple prompt is displayed using wrong charset
Previous Message Fujii Masao 2012-10-14 04:26:26 Re: pg_stat_lwlocks view - lwlocks statistics, round 2