pg_upgrade: dramatically reduce memory consumption

Report from Jeff Janes