Skip to content
ParticleDB

Import and export data

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.

Define explicit column types, primary keys and constraints. Test timestamps, nulls, non-ASCII text, decimal precision and large values with a small sample first.

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.

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.

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,title
1,Review request
2,Send response

Then import it from an authorized SQL connection:

COPY imported_tasks
FROM '/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.

Choose a writable destination on the database host:

COPY imported_tasks
TO '/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.

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.

Documentation home · Troubleshooting