Subject Re: [firebird-support] Temp Sort Area
Author Dmitry Yemanov
ruan_h wrote:
>
> 1. If within a query that's going to return a large number of records,
> there's more than 1 SORT, will the temp space be released immediately
> after each sort operation, or will each sort require its own temp
> space and release it all together at the end of transaction?

The temp space is released as soon as all rows are fetched from the sort
buffer. For the outer-most SORT, it usually means when the client
dataset/cursor is closed. For inner SORTs, it depends on their positions
inside a plan.

> 2. How to estimate the size of the temp area needed to do a SORT query
> ? I ran a query with GROUP BY, the raw set (before group) is about
> 0.5G, but I noticed that the temp space being used is about 4G in
> order to do the GROUP BY.

Calculation is a bit tricky. What's your row format and number of rows
(before grouping)?


Dmitry