Benchmark: Bulk INSERT vs COPY in PostgreSQL

Knowledge

Specially about usage of pg gem.

  • Don’t send too many rows using COPY at once.
  • The TEXT format will be better than CSV format for COPY.
    • The encoder class PG::TextEncoder::CopyRow is nice.
  • The COPY is faster than Bulk INSERT.

Benchmark