timescale / timescaledb-parallel-copy

A binary for parallel copying of CSV data into a TimescaleDB hypertable
https://www.timescale.com/
Apache License 2.0
354 stars 53 forks source link

Binary File Copy #41

Closed billglennon closed 1 month ago

billglennon commented 3 years ago

Just want to confirm that you can't copy in a binary file with timescaledb-parallel-copy. If you can, can you please provide an example of how to do it?

Example: Source is a PostgresQL 12x database and use the copy command with binary to create a binary file. psql -t -h mydbsvr.example.com -p 5432 -d mydb -U myuser -c "\COPY (SELECT * FROM my_test_table) TO '/mydata/my_test_table.copy' with binary";

It looks like timescaledb-parallel-copy only copies into the database csv files? I was able to successfully create a csv file from a copy command and using timescaledb-parallel-copy to copy that data into a new table.

I am trying to test this using only PostgreSQL 12 databases. No TimescaleDB. I saw this in the "Tip of the Week" in "Postgres Weekly" by Ryan Booz. "Note that Parallel Copy was developed primarily for use with TimescaleDB (a time-series database built on top of Postgres) but works with standard Postgres also."

Thanks!

alejandrodnm commented 1 month ago

You can specify different copy options with --copy-options, by default it's CSV, you could change it to BINARY. I don't know if this would actually work, since I'm not sure how the batches from the binary file would be created, or if you can disable splitting the lines based on the sep. But that's where I'd start.

I'm closing this since it's been a long time.