We're updating the issue view to help you get more done. 

PostgreSQL/MySQL need extra options to do insert-multi! with columns as a single operation

Description

java.jdbc uses a single prepared statement invocation for insert-multi! (columns) and provides each param group as a batch. By default, both PostgreSQL and MySQL run this as multiple statements, one for each batch of parameters (which is counter-intuitive, certainly as far as the JDBC docs are concerned).

However, you can provide options in your db-spec map to address this: PostgreSQL requires :reWriteBatchedInserts true and My SQL requires :rewriteBatchedStatement true (both non-standard JDBC options, of course!). This should cause the drivers to rewrite the SQL to a single insert with repeated values groups, and then it will do a single insert as "expected".

At a minimum, update the docstring for insert-multi! and the clojure-doc documentation.

But also consider actually producing that style of multiple insert SQL for databases known to support it (not all of them do). Perhaps introduce a new option on insert-multi! itself?

Environment

None

Status

Assignee

Sean Corfield

Reporter

Sean Corfield

Labels

None

Approval

None

Patch

None

Priority

Major