Use binary search instead of brute-force scan in findNamespace().

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 1a93588ffcad3e4876c9610c0a35d79c7fcdeffe
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2012-05-25T18:35:41Z
Releases: 9.1.4
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.

Files

PathChange+/−
src/bin/pg_dump/common.c modified +16 −2
src/bin/pg_dump/pg_dump.c modified +17 −22
src/bin/pg_dump/pg_dump.h modified +1 −0