]> granicus.if.org Git - postgresql/commit
Fix O(N^2) behavior in pg_dump for large numbers of owned sequences.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 31 Mar 2012 18:42:17 +0000 (14:42 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 31 Mar 2012 18:42:17 +0000 (14:42 -0400)
commit0d8117abefdae69dbec7465adf2c68f5cd0412ac
tree7ee22c996251c984fcf43899c5450f60b55228dc
parentc252a17d828756e2f7d635f69eace53aaf983420
Fix O(N^2) behavior in pg_dump for large numbers of owned sequences.

The loop that matched owned sequences to their owning tables required time
proportional to number of owned sequences times number of tables; although
this work was only expended in selective-dump situations, which is probably
why the issue wasn't recognized long since.  Refactor slightly so that we
can perform this work after the index array for findTableByOid has been
set up, reducing the time to O(M log N).

Per gripe from Mike Roest.  Since this is a longstanding performance bug,
backpatch to all supported versions.
src/bin/pg_dump/common.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h