Node-postgres: document bulk insert

Created on 24 Feb 2013  路  5Comments  路  Source: brianc/node-postgres

Hi, sorry to enter this as an issue.

I'm using .query("insert into...") and it's too slow.

I couldn't find how to bulk-insert data. It says something about the copy command in the README.md, but I wouldn't know how to use that (only ever used that to insert from csv file from psql shell)

can you give me a hint?

Most helpful comment

@anton-kotenko @brianc : Looks like the bulk load link is not available anymore. Is it documented somewhere else?

All 5 comments

Hi.
There are an example in #267
Client has additional methods copyFrom and copyTo. Both of them creates stream (writable/readable), and than you need to send correctly formatted text (csv or something else, like described here http://www.postgresql.org/docs/9.2/static/sql-copy.html) into stream

@anton-kotenko interested in adding those methods to the wiki?

Yes, I'll write docs in a few hours, when become more familiar with markdown syntax.
Add new chapter dedicated to Bulk data load https://github.com/brianc/node-postgres/wiki/Client#wiki-bulk-load.
But English is not my native language, so probably there are some mistakes in text.

@anton-kotenko thanks for documenting!

https://github.com/brianc/node-postgres/wiki/Client#wiki-bulk-load

@anton-kotenko @brianc : Looks like the bulk load link is not available anymore. Is it documented somewhere else?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spollack picture spollack  路  4Comments

Cosrnos picture Cosrnos  路  3Comments

v1co1n picture v1co1n  路  4Comments

wrod7 picture wrod7  路  4Comments

chrisjensen picture chrisjensen  路  4Comments