PostgreSQL 9.4 accepts multiple rows as values blocks in a single insert statement. What is the maximum number of rows that can be inserted this way?
INSERT VALUES limit is 1000, but it could be overriden with INSERT INTO SELECT FROM VALUES, as for second question in SQL world vast majority of statements are all-or-nothing.
It depends on how your sample "row" looks like. In general, RAM and swap of your Postgres box will be your limit before you get out-of-memory error. For bulk insert it's recommended to:
COPY
instead of INSERT
, postgresql.conf
, increase (maintenance_work_mem
,checkpoint_segments
)Full list of suggestions can be found in Populating a Database article. In addition to this, Managing Kernel Resources and Resource Consumption articles are worth checking.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With