usql icon indicating copy to clipboard operation
usql copied to clipboard

Batch insert in \copy to DB destination

Open murfffi opened this issue 1 year ago • 1 comments

Most databases support multi-row INSERT statements so it is possible to speed up \copy by using batches. This issue is discussed in the PR for Clickhouse \copy implementation - https://github.com/xo/usql/pull/457 .

Specifically, Clickhouse doesn't benefit from multi-row inserts within a Go SQL transaction, because the Clickhouse driver implements the Go transactions as batches anyway. All INSERTs in a transactions are written as a single batch always. Furthermore, the Clickhouse Go driver doesn't seem to support including multiple rows in an Exec on a prepared statement within a transaction/batch.

Still this feature can be implemented for other DBs.

murfffi avatar Apr 12 '24 15:04 murfffi

I volunteer to do this after https://github.com/xo/usql/pull/457 .

murfffi avatar Apr 12 '24 15:04 murfffi