Re: Sorting Improvements for 8.4

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: "Jeff Davis" <pgsql(at)j-davis(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Sorting Improvements for 8.4
Date: 2007-12-03 22:10:34
Message-ID: 87hcizsa3p.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Simon Riggs" <simon(at)2ndquadrant(dot)com> writes:

> The buffer size at max tapes is an optimum - a trade off between
> avoiding intermediate merging and merging efficiently. Freeing more
> memory is definitely going to help in the case of low work_mem and lots
> of runs.

I can't follow these abstract arguments. That's why I tried to spell out a
concrete example.

> I think you're not understanding me.
>
> You only need to record the lowest or highest when a run
> completes/starts. When all runs have been written we then have a table
> of the highest and lowest values for each run. We then scan that to see
> whether we can perform merging in one pass, or if not what kind of
> intermediate merging is required. We keep the merge plan in memory and
> then follow it. So probably very small % of total sort cost, though
> might save you doing intermediate merges with huge costs.

Ok, that's a very different concept than what I was thinking.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's On-Demand Production Tuning

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2007-12-03 22:35:18 Re: Sorting Improvements for 8.4
Previous Message Alvaro Herrera 2007-12-03 21:33:05 Re: Is postgres.gif missing in cvs?