postgresql/src/backend
Masahiko Sawada b840508644 Add functions to binaryheap for efficient key removal and update.
Previously, binaryheap didn't support updating a key and removing a
node in an efficient way. For example, in order to remove a node from
the binaryheap, the caller had to pass the node's position within the
array that the binaryheap internally has. Removing a node from the
binaryheap is done in O(log n) but searching for the key's position is
done in O(n).

This commit adds a hash table to binaryheap in order to track the
position of each nodes in the binaryheap. That way, by using newly
added functions such as binaryheap_update_up() etc., both updating a
key and removing a node can be done in O(1) on an average and O(log n)
in worst case. This is known as the indexed binary heap. The caller
can specify to use the indexed binaryheap by passing indexed = true.

The current code does not use the new indexing logic, but it will be
used by an upcoming patch.

Reviewed-by: Vignesh C, Peter Smith, Hayato Kuroda, Ajin Cherian,
Tomas Vondra, Shubham Khanna
Discussion: https://postgr.es/m/CAD21AoDffo37RC-eUuyHJKVEr017V2YYDLyn1xF_00ofptWbkg%40mail.gmail.com
2024-04-03 10:44:21 +09:00
..
access Implement pg_wal_replay_wait() stored procedure 2024-04-02 22:48:03 +03:00
archive Add macro for customizing an archiving WARNING message. 2024-03-04 15:41:42 -06:00
backup Revert "Temporary patch to help debug pg_walsummary test failures." 2024-03-20 11:34:00 -05:00
bootstrap Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
catalog Implement pg_wal_replay_wait() stored procedure 2024-04-02 22:48:03 +03:00
commands Implement pg_wal_replay_wait() stored procedure 2024-04-02 22:48:03 +03:00
executor Add functions to binaryheap for efficient key removal and update. 2024-04-03 10:44:21 +09:00
foreign Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
jit Add SQL/JSON query functions 2024-03-21 17:07:03 +09:00
lib Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
libpq Revert "Add notBefore and notAfter to SSL cert info display" 2024-03-22 22:58:41 +01:00
main Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
nodes Add support for MERGE ... WHEN NOT MATCHED BY SOURCE. 2024-03-30 10:00:26 +00:00
optimizer Don't zero tuple_fraction when planning UNIONs with ORDER BYs 2024-04-03 11:40:33 +13:00
parser Add new COPY option LOG_VERBOSITY. 2024-04-01 15:25:25 +09:00
partitioning Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
po Update copyright for 2024 2024-01-03 20:49:05 -05:00
port Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
postmaster Add functions to binaryheap for efficient key removal and update. 2024-04-03 10:44:21 +09:00
regex Support C.UTF-8 locale in the new builtin collation provider. 2024-03-19 15:24:41 -07:00
replication Add functions to binaryheap for efficient key removal and update. 2024-04-03 10:44:21 +09:00
rewrite Add RETURNING support to MERGE. 2024-03-17 13:58:59 +00:00
snowball Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
statistics Make stxstattarget nullable 2024-03-17 12:26:26 +01:00
storage Add functions to binaryheap for efficient key removal and update. 2024-04-03 10:44:21 +09:00
tcop Do not output actual value of location fields in node serialization by default 2024-03-22 09:49:12 +01:00
tsearch Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
utils Implement pg_wal_replay_wait() stored procedure 2024-04-02 22:48:03 +03:00
.gitignore
Makefile Rework lwlocknames.txt to become lwlocklist.h 2024-03-20 11:55:20 +01:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
meson.build Remove AIX support 2024-02-28 15:17:23 +04:00
nls.mk Remove distprep 2023-11-06 15:18:04 +01:00