| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | pgsql-committers(at)postgresql(dot)org |
| Subject: | pgsql: Improve ResourceOwners' behavior for large numbers of owned obje |
| Date: | 2016-01-26 20:20:49 |
| Message-ID: | [email protected] |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Improve ResourceOwners' behavior for large numbers of owned objects.
The original coding was quite fast so long as objects were always
released in reverse order of addition; otherwise, it degenerated into
O(N^2) behavior due to searching for the array element to delete.
Improve matters by switching to hashed storage when the number of
objects of a given type exceeds 64. (The cutover point is open to
discussion, of course, but some simple performance testing suggests
that hashing has enough overhead to be a loser below there.)
Also, refactor resowner.c so that we don't need N copies of the array
management code. Since all the resource IDs the code currently needs
to deal with are either pointers or integers, it seems sufficient to
create a one-size-fits-all infrastructure in which everything is
converted to a Datum for storage.
Aleksander Alekseev, reviewed by Stas Kelvich, further fixes by me
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/cc988fbb0bf60a83b628b5615e6bade5ae9ae6f4
Modified Files
--------------
src/backend/access/hash/hashfunc.c | 3 +
src/backend/utils/resowner/resowner.c | 955 +++++++++++++++------------------
2 files changed, 446 insertions(+), 512 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2016-01-26 20:38:57 | pgsql: Fix startup so that log prefix %h works for the log_connections |
| Previous Message | Kevin Grittner | 2016-01-26 14:48:18 | pgsql: Various fixes to REFRESH MATERIALIZED VIEW tab completion. |