I was able to use batch insert for exposed, but when I am adding ``` transaction { ...
t
I was able to use batch insert for exposed, but when I am adding
Copy code
transaction {
            addLogger(StdOutSqlLogger)
            SomeTable.batchInsert(data = listOf(1,2,3,4)) {
                this[SomeTable.someColumn] = it
            }
SQL logger shows multiple sql inserts(number of insrets = list.size) Should not it be one insert with multiple values? Or is it StdOutLogger problems?
s
Afaik not all databases support batch insert
What are you using?
t
postgre
I think it should
any idea?
😦 1
t
Exposed uses jdbc batching and all other things are implemented by jdbc-driver. For example, mysql driver has connection option to enable
sending batches in a one statement
) Looks like there is similar one for PostgreSQL https://vladmihalcea.com/postgresql-multi-row-insert-rewritebatchedinserts-property/
1028 Views