Re: Fwd: [ADMIN] Confuse about the behaveior of PreparedStatement.executeBatch (jdbc)
От | Kris Jurka |
---|---|
Тема | Re: Fwd: [ADMIN] Confuse about the behaveior of PreparedStatement.executeBatch (jdbc) |
Дата | |
Msg-id | alpine.BSO.2.00.1212141147030.30031@leary.csoft.net обсуждение исходный текст |
Ответ на | Re: Fwd: [ADMIN] Confuse about the behaveior of PreparedStatement.executeBatch (jdbc) (Haifeng Liu <liuhaifeng@live.com>) |
Список | pgsql-jdbc |
On Sat, 15 Dec 2012, Haifeng Liu wrote: > I did a simple test and found that if one of the batch failed, the other > update may be execute partially. when I test with 10 updates a batch, > none of them are updated, when I test with 1000 updates a batch, about > 700+ of them are executed, but the failed update should be the last one, > which means 999 executed updates is more reasonable than 700+. But > really weird thing is the getUpdateCounts method returns the reasonable > information. > > I don't know what happened inside this driver. Currently I have to > setAutoCommit to false and use commit/rollback to achieve my goal. > Internally the driver splits each batch into sub-batches of 250 to send to the server to reduce the possibility of deadlocking the network connection. When auto-commit is enabled in the driver, the auto-commit setting affects the whole sub-batch of 250 because of how the frontend/backend protocol works. So you are seeing some oddities because of some implementation details and you should not use auto-commit with batch statements. Kris Jurka
В списке pgsql-jdbc по дате отправления: