I'm inserting millions of records, coming from C++ structures. With regular inserts, I'm getting a terrible performance, with the database taking up 98% of program time, even after config optimization. I'm reading that I should use COPY to import it from a CSV-file.
Now I'm not so sure if writing to a CSV-file first and then rewriting it to the DB will be much of an improvement, since the writing will double. I've looked at piping the STDIN, but at first glance it seems like there's also much overhead, and it's limited
If I've got a string in CSV-format, what would be the quickest way to write that data to my DB?
Thank you in advance,
CX