2

I would like to understand if increasing work_mem does help improving the speed of the COPY command.

Does COPY use work_mem or maint_work_mem extensively?

asked Aug 21, 2019 at 14:02
2
  • Are you using COPY for a table, or for the results of a query? If the latter, then optimizing the query will be the way to speed things up. Commented Aug 21, 2019 at 14:17
  • It's COPY for a table which is 250 GB and I am importing it from S3 to RDS Postgres Commented Aug 21, 2019 at 14:26

1 Answer 1

8

No, COPY does not need a lot of memory.

There are two things to speed up COPY:

  • Remove any indexes and constraints on the table before you COPY into it.

  • Increase max_wal_size so that you don't get more checkpoints than necessary.

    Of course, if you COPY into an UNLOGGED table, it will be even faster.

answered Aug 21, 2019 at 14:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.