Tokio postgres bulk insert

Hi,
I was trying to find example for bulk insert using tokio postgres, the examples given by chat gpt didn't compile(may be I don't have sufficient knowledge in rust), simple insert worked, can some one share compliable example of bulk insert or point to example from where i can build my sample example
Regards
Amit

The tokio-postgres crate just takes an SQL statement as a string, so you do a bulk insert by sending it an SQL statement that inserts multiple elements.

1 Like

COPY queries can be more efficient for bulk inserts as well: rust-postgres/tokio-postgres/tests/test/binary_copy.rs at master · sfackler/rust-postgres · GitHub

2 Likes