Mod
11/02/2023, 5:59 AMprivate fun createHikariDataSource(
url: String,
driver: String,
user: String,
password: String,
maxPoolSize: Int,
autoCommit: Boolean
) = HikariDataSource(HikariConfig().apply {
addDataSourceProperty("reWriteBatchedInserts", true)
driverClassName = driver
jdbcUrl = url
username = user
this.password = password
maximumPoolSize = maxPoolSize
isAutoCommit = autoCommit
isReadOnly = false
transactionIsolation = "TRANSACTION_REPEATABLE_READ"
addDataSourceProperty("reWriteBatchedInserts", true)
validate()
})
and tried to pass the flag in the url like
val connectionPool = createHikariDataSource(
url = "$jdbcURL/$defaultDatabase?reWriteBatchedInserts=true",
driver = driverClassName,
user = username,
password = password,
maxPoolSize.toInt(),
autoCommit.toBoolean()
)
and still the batch statement won't workDominik Sandjaja
11/02/2023, 5:05 PMINSERT INTO ...
Mod
11/02/2023, 5:07 PMDominik Sandjaja
11/02/2023, 5:07 PMIf you want to check if the+rewriteBatchedInserts
is working correctly, check how to enable JDBC logging for your driver because Exposed will always show the non-rewritten multiple inserts. You can find the documentation for how to enable logging in PostgreSQL here.batchInsert
Mod
11/02/2023, 5:08 PMDominik Sandjaja
11/02/2023, 5:16 PMMod
11/02/2023, 7:30 PM