High-Performance Java Persistence Newsletter, Issue 16

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

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 that explains how you can activate the slow query log in PostgreSQL using either the log_duration setting or the pg_stat_statements extension.

If you want to implement an audit log mechanism using PostgreSQL, then you can use a functional trigger to intercept INSERT, UPDATE, and DELETE statements and store the state of the row before and after the DML statement is executed in jsonb columns. For more details about this technique, check out this article.

PostgreSQL provides a great variety of column types, and for store date and time info, you can use date, time, timestamp, tsrange, or daterange. If you want to get a better understanding of all these types, then you should definitely read this article.

Sometimes, the default PostgreSQL statistics might not be suitable for all types of queries, so you need to enable the extended statistics to provide more accurate data value distribution info to the database optimizer. For instance, this article explains how you can optimize a certain query so that its execution is reduced from 2 minutes to 42 milliseconds.

SQL provides many operators, that, unfortunately, are either not known very well or not employed. For example, the ANY operator allows you to match a given value against a list of values resulting from a subquery execution or from a VALUES clause. If you are interested in getting a better understanding of how the ANY operator works, then check out this article.

Workshop Recording

The online workshop I gave about Batch Processing Best Practices with JPA and Hibernate has been recorded and is available on Teachable.

This online workshop explains how JDBC batching works, and how you can get the most out of it with JPA and Hibernate. Because statement caching a very important performance tuning optimization, this workshop shows how you can enable server-side and client-side statement caching for Oracle, SQL Server, PostgreSQL, and MySQL. Last but not least, you will discover how the Persistence Context works and how to manage entities to speed up both read and write operations.

Project Releases

The 5.4.21 version of Hibernate ORM has been released. For more details about this release, check out the release notes on Jira.

Best Tweets

There are many social media platforms, but for me, Twitter is the one I like best. Here are the best tweets I posted since the last newsletter:

If you like this newsletter,

you are going to love the next episodes!

StackOverflow Answers

The following StackOverflow answers have been trending over the past two weeks:

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.

Hypersistence Optimizer 2.2 has been released!