pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Improve ResourceOwners' behavior for large numbers of owned obje
Date: Tue, 26 Jan 2016 20:20:49 +0000
Message-ID: <E1aOA6b-0005U2-Kt@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1aOA6b-0005U2-Kt@gemulon.postgresql.org>
Permalink:  ../E1aOA6b-0005U2-Kt@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1aOA6b-0005U2-Kt@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Improve ResourceOwners' behavior for large numbers of owned obje
  In-Reply-To: <E1aOA6b-0005U2-Kt@gemulon.postgresql.org>
  References: <E1aOA6b-0005U2-Kt@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox