Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcc988fb

Browse files
committed
Improve ResourceOwners' behavior for large numbers of owned objects.
The original coding was quite fast so long as objects were alwaysreleased in reverse order of addition; otherwise, it degenerated intoO(N^2) behavior due to searching for the array element to delete.Improve matters by switching to hashed storage when the number ofobjects of a given type exceeds 64. (The cutover point is open todiscussion, of course, but some simple performance testing suggeststhat hashing has enough overhead to be a loser below there.)Also, refactor resowner.c so that we don't need N copies of the arraymanagement code. Since all the resource IDs the code currently needsto deal with are either pointers or integers, it seems sufficient tocreate a one-size-fits-all infrastructure in which everything isconverted to a Datum for storage.Aleksander Alekseev, reviewed by Stas Kelvich, further fixes by me
1 parent879d713 commitcc988fb

File tree

2 files changed

+446
-512
lines changed

2 files changed

+446
-512
lines changed

‎src/backend/access/hash/hashfunc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ hashvarlena(PG_FUNCTION_ARGS)
297297
* of 2. There is no need to do mod a prime (mod is sooo slow!).
298298
* If you need less than 32 bits, use a bitmask.
299299
*
300+
* This procedure must never throw elog(ERROR); the ResourceOwner code
301+
* relies on this not to fail.
302+
*
300303
* Note: we could easily change this function to return a 64-bit hash value
301304
* by using the final values of both b and c. b is perhaps a little less
302305
* well mixed than c, however.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp