Import and export data
Choose a supported path
Section titled “Choose a supported path”Start with your client’s parameterized writes and bounded batches. For SQL bulk loading, consult SQL commands and verify the format and command against your installed release before importing a large dataset.
Do not assume that a PostgreSQL export, extension or external table format can be loaded unchanged. Migration lists compatibility considerations.
Prepare the destination
Section titled “Prepare the destination”Define explicit column types, primary keys and constraints. Test timestamps, nulls, non-ASCII text, decimal precision and large values with a small sample first.
Load in batches
Section titled “Load in batches”Keep batches small enough to retry without exhausting memory. Use a transaction for each batch where supported. Record a checkpoint only after its commit succeeds.
Use stable primary keys so you can detect or reconcile records when a connection fails after a commit. Avoid constructing SQL with unescaped input.
Validate
Section titled “Validate”Compare record counts and representative values:
SELECT COUNT(*) AS records FROM work_items;SELECT id, title, status FROM work_items ORDER BY id LIMIT 10;This example uses the table from relational data.
Import CSV on the server
Section titled “Import CSV on the server”For a file readable by the database service account, create the destination table first:
CREATE TABLE imported_tasks (id BIGINT PRIMARY KEY, title TEXT);Save this as /var/lib/particledb/import/tasks.csv on the database host:
id,title1,Review request2,Send responseThen import it from an authorized SQL connection:
COPY imported_tasksFROM '/var/lib/particledb/import/tasks.csv'WITH (FORMAT CSV, HEADER true);SELECT id, title FROM imported_tasks ORDER BY id;The result contains IDs 1 and 2 with their titles. HEADER true skips the header row; without it the first row is treated as data. The path is on the server, so a file on your laptop is not automatically accessible to a remote database. Use parameterized application writes when the server cannot access the source file.
Export CSV
Section titled “Export CSV”Choose a writable destination on the database host:
COPY imported_tasksTO '/var/lib/particledb/import/tasks-export.csv'(FORMAT CSV);Verify the exported file before using it as an input to another system. Keep file-access privileges restricted to the service account and approved import/export directories.
Export and recovery
Section titled “Export and recovery”A query result export is not a complete database backup: it may omit schema, indexes, privileges and function definitions. Plan export, restore and rollback separately using the durability guide.