Re: Memory usage during sorting

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memory usage during sorting
Date: 2012-01-22 00:51:58
Message-ID: CAEYLb_U809HrV+vYMjmL-8W_md6DU6+=XMZYwE8yg3NYXuj-Ag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16 January 2012 00:59, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> I think it would be better to pre-deduct the tape overhead amount we
> will need if we decide to switch to tape sort from the availMem before
> we even start reading (and then add it back if we do indeed make that
> switch).  That way we wouldn't over-run the memory in the first place.
>  However, that would cause apparent regressions in which sorts that
> previously fit into maintenance_work_mem no longer do.  Boosting
> maintenance_work_mem to a level that was actually being used
> previously would fix those regressions, but pointing out that the
> previous behavior was not optimal doesn't change the fact that people
> are used to it and perhaps tuned to it.  So the attached patch seems
> more backwards-friendly.

Hmm. Are people really setting maintenance_work_mem such that it is
exactly large enough to quicksort when building an index in one case
but not another? Is the difference large enough to warrant avoiding
pre-deduction?

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2012-01-22 02:50:31 Re: show Heap Fetches in EXPLAIN for index-only scans
Previous Message Jeff Janes 2012-01-21 23:32:09 Re: Publish checkpoint timing and sync files summary data to pg_stat_bgwriter