IT lexicon › Database › COPY

COPY bulk loading

Database På svenska → Updated: 2026-07-29

PostgreSQL's command for reading in or writing out large amounts of data in one go. Orders of magnitude faster than running INSERT row by row.

The difference is that each individual INSERT otherwise means parsing, planning, its own transaction and a round trip to the server. COPY streams everything in a single operation with minimal per-row overhead. The server-side command reads files on the database server and therefore needs special privileges; the client variant \copy in psql reads locally and is usually what you want. Formats: text, CSV or binary. For really large loads it pays to create indexes and foreign keys after loading rather than before, and to disable triggers. MySQL's equivalent is LOAD DATA INFILE.

← Back to the lexicon