mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
Replace binaryheap + index with pairingheap in reorderbuffer.c
A pairing heap can perform the same operations as the binary heap + index, with as good or better algorithmic complexity, and that's an existing data structure so that we don't need to invent anything new compared to v16. This commit makes the new binaryheap functionality that was added in commitsb840508644
andbcb14f4abc
unnecessary, but they will be reverted separately. Remove the optimization to only build and maintain the heap when the amount of memory used is close to the limit, becuase the bookkeeping overhead with the pairing heap seems to be small enough that it doesn't matter in practice. Reported-by: Jeff Davis Author: Heikki Linnakangas Reviewed-by: Michael Paquier, Hayato Kuroda, Masahiko Sawada Discussion: https://postgr.es/m/12747c15811d94efcc5cda72d6b35c80d7bf3443.camel%40j-davis.com
This commit is contained in:
@ -10,8 +10,8 @@
|
||||
#define REORDERBUFFER_H
|
||||
|
||||
#include "access/htup_details.h"
|
||||
#include "lib/binaryheap.h"
|
||||
#include "lib/ilist.h"
|
||||
#include "lib/pairingheap.h"
|
||||
#include "storage/sinval.h"
|
||||
#include "utils/hsearch.h"
|
||||
#include "utils/relcache.h"
|
||||
@ -402,6 +402,11 @@ typedef struct ReorderBufferTXN
|
||||
*/
|
||||
dlist_node catchange_node;
|
||||
|
||||
/*
|
||||
* A node in txn_heap
|
||||
*/
|
||||
pairingheap_node txn_node;
|
||||
|
||||
/*
|
||||
* Size of this transaction (changes currently in memory, in bytes).
|
||||
*/
|
||||
@ -633,7 +638,7 @@ struct ReorderBuffer
|
||||
Size size;
|
||||
|
||||
/* Max-heap for sizes of all top-level and sub transactions */
|
||||
binaryheap *txn_heap;
|
||||
pairingheap *txn_heap;
|
||||
|
||||
/*
|
||||
* Statistics about transactions spilled to disk.
|
||||
|
Reference in New Issue
Block a user