External loading programs

Another thing to be aware of is that COPY will abort all its work if it finds any error in the input data. This can be frustrating if the bad row is near the end of a large input. If you're importing from an external data source (a dump out of a non-PostgreSQL database, for example), you should consider a loader that saves rejected rows while continuing to work anyway, like pgloader, (http://pgfoundry.org/projects/pgloader/). pgloader will not be as fast as COPY, but it's easier to work with on dirty input data and it can handle more types of input formats, too.

Another loader useful for some special cases is pg_bulkload. It can be even faster than straight COPY. This is due to very aggressive performance features, ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.