0

I am trying to do bulk insert data in postgres using Binary copy, as below

await connection.BeginBinaryImportAsync($"COPY ph_numbers FROM STDIN (FORMAT BINARY));

This table already contains millions of records and I just want to ignore the records already present there.

I went through the documentation and could not find any efficient way to ignore duplicates.

1 Answer 1

3

There is no way to ignore duplicates.

You can COPY the data to a temporary table and then use INSERT ... SELECT ... ON CONFLICT ... DO NOTHING to merge the data into your existing table.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.