sfackler / rust-postgres

Native PostgreSQL driver for the Rust programming language
Apache License 2.0
3.39k stars 429 forks source link

A way to supply your own binary for copy #1114

Open funlennysub opened 4 months ago

funlennysub commented 4 months ago

Is there a way i can pass my own byte array to copy command? From my testing current writer takes ~5 minutes on my laptop to output a binary for ~9mil entries (15 fields) while my own simple impl takes ~20 sec, I'd like to spend as little time as possible on generation if possible

sfackler commented 4 months ago

Yes:

https://docs.rs/postgres/latest/postgres/struct.CopyInWriter.html#impl-Write-for-CopyInWriter%3C'_%3E https://docs.rs/tokio-postgres/latest/tokio_postgres/struct.CopyInSink.html#impl-Sink%3CT%3E-for-CopyInSink%3CT%3E