Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> What I'm saying is that you can write a heap file, on which the tuples
> would all have xmin=FrozenTransactionId, xmax=Invalid, and the
> corresponding bits set in the infomask. This ensures that no matter the
> state of the server, you can plug the file in and all tuples will be
> valid.
> The "only" problem is figuring out how to lay the data in the tuples
> themselves, w.r.t endianness and such. This is platform-dependent, so
> you have to write code to do it correctly. In absence of user-defined
> types, this should not be _too_ hard to do. Of course, such a program
> would in general also be Postgres-version-dependent.
Of course, it's fair to ask whether such a program would be any faster
than binary-mode COPY by the time you got done ... or enough faster to
justify your effort, anyway.
THe only fundamental disadvantage that COPY labors under is having to
write WAL records. It might be interesting to do something similar to
the recent hacks for CREATE TABLE AS, so that a COPY into a table just
created in the current transaction would skip writing WAL and instead
fsync the table at the end.
regards, tom lane