Populating Table Data with \COPY

PostgreSQL supports bulk loading data from CSV files. This can be very efficient. The CSV file can contain millions of rows, which can be loaded quickly using the \COPY command.

These are some use cases:

  • Consuming a large public data set, distributed as CSV files

  • Ingesting data from another PostgreSQL system or different database system, using intermediate CSV files

  • Creating an Extract Transform Load (ETL) pipeline, using CSV files as intermediaries

Try dumping data from Rideshare while connected to the rideshare_development database. Connect normally using the owner role. Use the client version of the COPY command, which starts with a backslash. Before running these commands, you may want to reset it to the ...

Get High Performance PostgreSQL for Rails 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.