| From: | Chris Mair <chris(at)1006(dot)org> |
|---|---|
| To: | a <372660931(at)qq(dot)com> |
| Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: How to insert bulk data with libpq in C? |
| Date: | 2018-12-18 09:14:51 |
| Message-ID: | a147f147f02ace8c2268d39a5933093f@smtp.hushmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
>> May I ask the proper (fast) way of inserting bulk data and if possible, an example would be very appreciated.
>>
>> Please note that the data I would like to insert contains arrays (float8[]).
>>
>> By the way, my environment is Windows 10, PostgreSQL 11 and compiling with Visual Studio 2017.
>
> That would be COPY:
> https://www.postgresql.org/docs/current/sql-copy.html
In particular,
copy table (col1, col2, ...) from stdin with binary
see also
https://www.postgresql.org/docs/10/static/protocol-flow.html#PROTOCOL-COPY
https://www.postgresql.org/docs/10/static/sql-copy.html#id-1.9.3.52.9.4
Also, I suggesttransaction bundling (one commit every 1000 records or so),
depending on context.
Bye,
Chris.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Laurenz Albe | 2018-12-18 10:46:10 | Re: How to insert bulk data with libpq in C? |
| Previous Message | Laurenz Albe | 2018-12-18 08:24:04 | Re: How to insert bulk data with libpq in C? |