postgres-impl-bulk-loading
Installation
SKILL.md
postgres-impl-bulk-loading
Quick Reference :
COPY is the fast path for bulk data : an order of magnitude faster than INSERT
because it bypasses per-row statement parsing and planning. Pick the transport by
where the file lives :
File on the DB server machine -> COPY ... FROM '/abs/path' (server-side)
File on the client machine -> \copy ... FROM 'path' (psql, client-side)
Data streamed by an app/driver -> COPY ... FROM STDIN (psycopg, JDBC, etc.)
Performance ladder, fastest first : COPY >> multi-row INSERT (one statement,
many VALUES rows) >> single-row INSERT in a loop. NEVER write a row-by-row
INSERT loop for bulk data.