Subject Re: [firebird-support] PSQL: Getting both aggregation and individual rows
Author Josef Kokeš
On 27.10.2014 10:35, Svein Erling Tysvær
svein.erling.tysvaer@... [firebird-support] wrote:
>> I tried this approach before, but it violates my "only run GET_DATA
>>once" requirement :-(
> Well, with EXECUTE BLOCK and ORDER BY it may be possible to satisfy your
> MIN requirement, but I can't logically understand how it even
> theoretically wold be possible to know the SUM before having gone
> through all records. Window functions in Fb 3 is probably the best

I don't mind going through the recordset twice, but I do mind creating
two recordsets. The temp-table approach satisfies my needs nicely, but I
was hoping there is a more elegant solution.

> Not that I think it matters too much, I assume the first pass to be more
> costly than the second. Have you measured how much more time is required

It's not a matter of time. The second pass would generate completely
different data (think a random number generator).