Re: Support loser tree for k-way merge

Heikki Linnakangas <hlinnaka@iki.fi>

From: Heikki Linnakangas <hlinnaka@iki.fi>
To: cca5507 <cca5507@qq.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-12-03T12:23:53Z
Lists: pgsql-hackers
On 03/12/2025 13:48, cca5507 wrote:
> With the WIP patch(v1-0001), I got a 3% ~ 13%(different work_mem) speed up in the following test case:

Nice speedup!

> 1) Now I add a GUC 'enable_loser_tree' to control the use of loser tree, maybe we should
> decide whether to use the 'loser tree' based on the value of 'k', the complexity of tuple
> comparators or just always use the 'loser tree'?

What is the worst case scenario for the loser tree, where the heap is 
faster? How big is the difference?

- Heikki