Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] PostgreSQL COPY #234

Closed
kwladyka opened this issue Nov 6, 2022 · 1 comment
Closed

[feature] PostgreSQL COPY #234

kwladyka opened this issue Nov 6, 2022 · 1 comment

Comments

@kwladyka
Copy link

kwladyka commented Nov 6, 2022

Is your feature request related to a problem? Please describe.
COPY is the faster way to write a lot of data to DB. Much more faster, than INSERT. With writing a lot of data to DB it makes a really big difference in performance.

Describe the solution you'd like
Add COPY support with STDIN and BINARY. But while doing this it is very reasonable to add support for all FORMAT (BINARY / CSV / TEXT) and FROM / TO (STDIN / STOUT / PROGRAM / filename).

As I understand BINARY need extra support for data types. But it is gives the fastest way to write do DB as possible. As far as I know there is nothing faster, than that.

Describe alternatives you've considered
There is https://github.com/jgdavey/clj-pgcopy but it is not maintained anymore. Last commit is 2 years ago. But https://github.com/jgdavey/clj-pgcopy/blob/main/src/clj_pgcopy/core.clj can be good place to learn about COPY.

I consulted the best way to write a lot of data to PostgreSQL on PostgreSQL slack and they are very clear about this solution as the right one and the most performant one. Definitely COPY instead of INSERT.

Additional context
PostgreSQL official documentation
https://www.postgresql.org/docs/current/sql-copy.html

@seancorfield
Copy link
Owner

PostgreSQL-specific. Not appropriate for next.jdbc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants