Re: [Patch] Build the heap more efficient in tuplesort.c

From: cca5507 <cca5507(at)qq(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [Patch] Build the heap more efficient in tuplesort.c
Date: 2025-12-01 16:05:30
Message-ID: tencent_1D73A1CE850DB5F1294932EA7844071D7608@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Generally speaking, build the heap by tuplesort_heap_build() is O(n) while tuplesort_heap_insert() is
O(n log n), so the former is better.

I'm not sure why tuplesort_heap_build() is worse than tuplesort_heap_insert() when handling random
data sometimes, maybe my test method is wrong? Any ideas?

The v2-0001 refactor some code, mark some function as always inline and reduce some useless copy
of SortTuple.

--
Regards,
ChangAo Chen

Attachment Content-Type Size
v2-0001-Build-the-heap-more-efficient-in-tuplesort.c.patch application/octet-stream 8.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-12-01 16:08:15 Re: warning: dereferencing type-punned pointer
Previous Message Robert Haas 2025-12-01 15:58:55 Re: show size of DSAs and dshash tables in pg_dsm_registry_allocations