Re: pgsql: In pg_upgrade, copy fsm, vm, and extent files by checking for fi - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: In pg_upgrade, copy fsm, vm, and extent files by checking for fi
Date
Msg-id 27789.1352932769@sss.pgh.pa.us
Whole thread Raw
In response to pgsql: In pg_upgrade, copy fsm, vm, and extent files by checking for fi  (Bruce Momjian <bruce@momjian.us>)
Responses Re: pgsql: In pg_upgrade, copy fsm, vm, and extent files by checking for fi
List pgsql-committers
Bruce Momjian <bruce@momjian.us> writes:
> In pg_upgrade, copy fsm, vm, and extent files by checking for file
> existence via open(), rather than collecting a directory listing and
> looking up matching relfilenode files with sequential scans of the
> array.  This speeds up pg_upgrade by 2x for a large number of tables,
> e.g. 16k.

Uh ... you replaced a strcmp() with an open()?

I'm prepared to believe that's a win for sufficiently large N, if you
assume that the filesystem is smart enough to have O(1) lookup time
regardless of the directory size ... but that doesn't seem like a very
good assumption, and in any case surely this loses badly for a smaller
number of files.

You would have been better off keeping the array and sorting it so you
could use binary search, instead of passing the problem off to the
filesystem.

            regards, tom lane


pgsql-committers by date:

Previous
From: Bruce Momjian
Date:
Subject: pgsql: In pg_upgrade, copy fsm, vm, and extent files by checking for fi
Next
From: Bruce Momjian
Date:
Subject: Re: pgsql: In pg_upgrade, copy fsm, vm, and extent files by checking for fi