How to enable multi-row inserts with the PostgreSQL reWriteBatchedInserts configuration property

Introduction

Vladimir Sitnikov has been working on many optimizations to the PostgreSQL JDBC Driver, and one of these is the reWriteBatchedInserts configuration property which he recently told me about.

In this article, you will see how the reWriteBatchedInserts JDBC configuration property works in PostgreSQL, and how it allows you to rewrite INSERT statements into a multi-VALUE INSERT.

Continue reading “How to enable multi-row inserts with the PostgreSQL reWriteBatchedInserts configuration property”

How to optimize the merge operation using update while batching with JPA and Hibernate

Introduction

One of my readers has recently asked me about optimizing the merge entity state transition, and, because this is a great question, I decided to turn it into a blog post.

In this article, you are going to see a shortcoming of the merge entity state transition and how you can deal with it using Hibernate.

Continue reading “How to optimize the merge operation using update while batching with JPA and Hibernate”

The best way to do batch processing with JPA and Hibernate

Introduction

Recently, on of my followers asked me to answer a question on Quora about batch processing, and, since the question was really interesting, I decided to turn it into a blog post.

In this article, you are going to find out what batch processing is, why do we use it, and how to use it properly with JPA and Hibernate.

Continue reading “The best way to do batch processing with JPA and Hibernate”

How to find which statement failed in a JDBC Batch Update

Introduction

Yesterday, my Danish friend, Flemming Harms, asked my a very interesting question related to when a JDBC batch update fails.

Basically, considering we are going to group several DML statements in a batch, we need a way to tell which statement is the cause of the failure. This post is going to answer this question in more detail.

Continue reading “How to find which statement failed in a JDBC Batch Update”