dev-resources.site
for different kinds of informations.
Difference between INSERT and COPY in PostgreSQL
Published at
12/30/2020
Categories
postgres
database
opensource
showdev
Author
Thiago Avelino
Quite a number of reasons, actually, but the main ones are:
- Typically, client applications wait for confirmation of one
INSERT
's success before sending the next. So there's a round-trip delay for eachINSERT
, scheduling delays, etc (pREST supports pipelineing INSERTs in batches). This point is the most significant, It's all about network round-trips and rescheduling delays; - Each
INSERT
has to go through the whole executor. Use of a prepared statement bypasses the need to run the parser, rewriter and planner, but there's still executor state to set up and tear down for each row.COPY
does some setup once, and has an extremely low overhead for each row, especially where no triggers are involved.
pREST of COPY batches "INSERT's" support?
Yes, we support the insertion operation using COPY
when explained in the http protocol header.
Prest-Batch-Method: copy
, when not declared pREST will use INSERT
.
Articles
12 articles in total
How to reuse workflow in GitHub Action pipeline
read article
Reporting a problem in an Open Source project is as important as contributing code
read article
From wanting to be part of the CTO
read article
Clojure Twitter community
read article
We are more than 75,000 people (stars 🌟) — awesome-go
read article
Constant work to onboarding new members into engineering team
read article
7 subjects (and GitHub repositories) to become a better Go Developer
read article
When is the best time to share a "new" product?
read article
Full Text Search in PostgreSQL
read article
Difference between INSERT and COPY in PostgreSQL
currently reading
pREST Celebrating 2,441 GitHub Stars ✨
read article
Behind Open Source projects there are people
read article
Featured ones: