High-Performance Java Persistence Newsletter, Issue 54

Imagine having a tool that can automatically detect JPA and Hibernate performance issues. Wouldn’t that be just awesome?

Well, Hypersistence Optimizer is that tool! And it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, or Play Framework.

So, enjoy spending your time on the things you love rather than fixing performance issues in your production system on a Saturday night!

Introduction

Welcome to a new issue of the High-Performance Java Persistence Newsletter in which we share articles, videos, workshops, and StackOverflow answers that are very relevant to any developer who interacts with a database system using Java.

Articles

The pick of this edition is this article, which explains how you can use the Hibernate Statistics in order to assert the SQL queries executed by Hibernate. The Hibernate Statistics provides a lot of information that you can use to determine whether caching is effective or to validate the performance gains of a given optimization.

When using a relational database system, it’s very common to use auto-incremented numeric Primary Keys. To avoid guessing other identifier values, you can use various solutions. Most often, developers use UUIDs, but this doesn’t always play out well as UUIDs are quite large, and the version 4 identifiers start with random bytes, therefore compromising B+Tree indexes. If you want to see an efficient method to hide record identifiers, check out this article.

A very good article I read was this one about the cost of fragmentation in MySQL. The issue of random INSERTs applies to other databases that use clustered Indexes, like SQL Server or Index-Organized Tables in Oracle.

If you’re using SQL Server, then you should know that you can optimize batched INSERT into BULK INSERT by activating the useBulkCopyForBatchInsert JDBC configuration. If you’re interested in this topic, check out this article.

Another interesting article I read is this one, which described the Multi-Regional Architecture employed by Monday.com.

When using JPA bidirectional associations, it’s important to have synchronization methods. However, using these methods properly is not always obvious, and for this reason, I explained some best practices in this article.

Another very good read was this article about various features we’d really benefit from if the DB provided to us, like soft deletes, multi-tenancy, or data versioning.

If you’re using PostgreSQL and want to speed up your data access layer, you should make sure that your SQL queries can benefit from the existing statement caching feature. For more details about this topic, check out this article.

Best Tweets

Here are the best tweets I posted since the last newsletter:

Project Releases

PostgreSQL 15.4 was released, and it provides many fixes. If you’re using PostgreSQL 15, you might want to consider an upgrade.

Hypersistence Utils 3.5.2 was released, and it brings you a fix to the ListArrayType.

Get in touch with my latest articles!

StackOverflow Answers

The following StackOverflow answers have been trending since the last newsletter episode:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.