High-Performance Java Persistence Newsletter, Issue 63

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

What if there were a tool that could automatically detect what caused performance issues in your JPA and Hibernate data access layer?

Wouldn’t it be awesome to have such a tool to watch your application and prevent performance issues during development, long before they affect production systems?

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

So, rather than fixing performance issues in your production system on a Saturday night, you are better off using Hypersistence Optimizer to help you prevent those issues so that you can spend your time on the things that you love!

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 from Gergely Orosz about designing and scaling Bluesky. You will learn about favoring flexibility, how to scale the data access layer, how to migrate from PostgreSQL to ScyllaDB, and how to reduce infrastructure costs.

Speaking of PostgreSQL, if you run a query more than 5 times on the same database connection, the query will be cached on the server, and a generic plan will be used for the next executions. However, this can also lead to some issues if the parameter values that you are binding are skewed. For more details about this topic, check out this article for more details.

Another article worth reading is this one about various database schema anti-patterns and PostgreSQL limitations.

When having to export a large result set after executing a query, many developers choose streaming. However, there’s a more efficient way to achieve this goal using the COPY PostgreSQL command. If you want to learn more about the COPY command, then you can read this article.

A good article I read is this one about implementing a job processing queue using YugabyteDB. The usage of SKIP LOCKED is useful for other relational database systems, so the article will be valuable even if you are using PostgreSQL, MySQL, Oracle or SQL Server.

Starting with version 6.5, Hibernate allows you to use the ON CONFLICT clause in JPQL queries. If you want to learn how to use this new feature, then check out this article.

A lesser-known feature of JPA and Hibernate is the ability to revert a FetchType.EAGER association to FetchType.LAZY ta query time using fetchgraph. In case you have a legacy application where FetchType.EAGER was used extensively, you should definitely read this article and learn how to use fetchgraph to avoid N+1 query issues or unnecessary joins.

Project Releases

The 2.9 version of Hypersistence Optimizer has been released and brings you support for Hibernate 6.5.

PostgreSQL 16.3 has been released, so if you’re using PostgreSQL 16, you might want to give it a try.

The SQL Server JDBC Driver has released the 12.6.2 version, providing several bug fixes for the 12.6 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.