pgsql: Use binary search instead of brute-force scan in findNamespace() - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Use binary search instead of brute-force scan in findNamespace()
Date
Msg-id E1SXzNM-0007Bh-SK@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Use binary search instead of brute-force scan in findNamespace().

The previous coding presented a significant bottleneck when dumping
databases containing many thousands of schemas, since the total time
spent searching would increase roughly as O(N^2) in the number of objects.
Noted by Jeff Janes, though I rewrote his proposed patch to use the
existing findObjectByOid infrastructure.

Since this is a longstanding performance bug, backpatch to all supported
versions.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/1a93588ffcad3e4876c9610c0a35d79c7fcdeffe

Modified Files
--------------
src/bin/pg_dump/common.c  |   18 ++++++++++++++++--
src/bin/pg_dump/pg_dump.c |   39 +++++++++++++++++----------------------
src/bin/pg_dump/pg_dump.h |    1 +
3 files changed, 34 insertions(+), 24 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Use binary search instead of brute-force scan in findNamespace()
Next
From: Tom Lane
Date:
Subject: pgsql: Use binary search instead of brute-force scan in findNamespace()