Loads data from a local or server-side CSV file into a ParadeDB (PostgreSQL) table through the COPY command.
COPY is ParadeDB’s fastest bulk-load method because it streams rows directly into shared buffers, bypassing client round-trips.It supports CSV, sets column order, handles headers, and can transform data on the fly with SELECT.
Confirm the target table exists, the CSV columns match the table order (or list columns explicitly), and the ParadeDB role has INSERT permission plus access to the file path on the server (or use \copy from psql).
Use either server-side COPY or client-side \copy. Server-side requires superuser or the pg_read_server_files role.Client-side works from psql and reads the file from your workstation.
Execute COPY Customers FROM '/data/new_customers.csv' WITH (FORMAT csv, HEADER true);.ParadeDB will append every CSV row to Customers, auto-parsing commas and ignoring the first header line.
List them: COPY Customers(name, email) FROM '/data/new_customers.csv' WITH (FORMAT csv, HEADER true); Missing id and created_at will receive their DEFAULT values (such as a sequence and now()).
PostgreSQL 14+ supports the LOG ERRORS extension, but for ParadeDB pre-14 use a staging table.COPY into staging, validate, then INSERT … SELECT into the live table.
Run \copy Orders FROM '~/Downloads/orders_q1.csv' CSV HEADER;.The file is read by psql, then streamed over the client connection so server file privileges are unnecessary.
BEGIN; COPY …; COMMIT; lets you ROLLBACK if the load fails, preserving data integrity.
For massive files, drop or defer constraints, or use ALTER TABLE … DISABLE TRIGGER ALL; COPY; ALTER TABLE … ENABLE TRIGGER ALL; to speed up ingest.
• Migrate a product catalog from a supplier
• Backfill historical orders
• Sync stock counts from a warehouse system
• Seed test environments with anonymized customer data
Watch pg_stat_progress_copy, check log_line_prefix for duration, or run \\watch on SELECT relname, tuples_imported FROM pg_stat_progress_copy;
Validate CSV format, use HEADER true, load into a staging table for complex checks, wrap in explicit transactions, and analyze the table afterward to update statistics.
.
Yes. ParadeDB supports COPY … FROM PROGRAM 'gunzip -c file.csv.gz' to stream decompressed data, but it requires superuser privileges.
ParadeDB lacks native row-level error skipping. Load into a staging table, then use WHERE clauses or CHECK constraints to filter invalid data before inserting into production tables.
Yes. If COPY runs inside BEGIN; …; COMMIT; and an error occurs, the entire load rolls back, leaving tables unchanged.