High-Performance Java Persistence Newsletter, Issue 61

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 week is this article about Jakarta Persistence 3.2, which brings a lot of improvements to the JPA specifications, such as programmatic configurations, transaction utility methods, JPQL enhancements that are now available only in Hibernate 6 (e.g., UNION, INTERSECT), ad-hoc joins, better DDL generations, new Types (e.g., Instant, Year), and many more.

If you’re using PostgreSQL and want to speed up query execution, then indexing becomes inevitable. However, PostgreSQL doesn’t just offer the very well-known B+Tree index that’s ubiquitous in relational database systems. PostgreSQL also offers Hash, GIN, GiST, or BRIN. For more details about all these indexing options, check out this article.

If you are developing AI applications that require NLP (Natural Language Processing) or Recommendation Systems, then you will have to do vector similarity search operations, and the pgvector extension can really help you achieve that goal. If you are interested in how you can index vector column types, then check out this article.

Speaking of indexes, PostgreSQL provides the Heap-Only-Tuple or HOT optimization that can reduce the write amplification incurred by indexes. If you are interested in how this optimization works and what limitation is has, the check out this article.

When investigating a slow-running SQL query, the execution plan can help us understand what operations are executed by the database when running the query. However, while EXPLAIN ANALYZE is a popular choice, there is a lesser-known option that can really help you find physical reads that could be replaced by logical reads. For more details about the BUFFERS option, check out this article.

Videos

I found a very good talk by Maciej Walkowiak about performance when using Spring Data JPA and Hibernate that was given at Voxxed Days Zürich.

So, if you are using Spring and Hibernate, you will learn a lot of good tips from this presentation.

Online Workshop

On the 12th of March, I ran the first edition of my Spring Data JPA online course, in which we covered the best way to map JPA entities when using Spring Data JPA.

The workshop was record, and if you are interested in getting the best out of Spring Data JPA in your application, then you should definitely buy the course and watch the recordings.

Project Releases

The first candidate release of the 6.5.0 version was published, and it brings you support for JPA 3.2, support for Keyset Pagination, a new second-level query cache storage that allows you to save the entire query result set, and not just the entity identifiers or a the column projection, support for JOINs in bulk update and delete statements, support for ON CONFLICT clause, and many more.

The PostgreSQL JDBC Driver released the 42.7.3 version that provides several bug fixes for the 42 branch.

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.