High-Performance Java Persistence Newsletter, Issue 16
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!
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.
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
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
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.
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:
I use Tab-Driven Development. The more difficult the task, the more browser tabs I open.— Vlad Mihalcea (@vlad_mihalcea) August 19, 2020
Developing software is easy. Developing software with other people is hard.— Vlad Mihalcea (@vlad_mihalcea) August 17, 2020
Developers are very indulgent when it comes to their own code, but extremely critical when it comes to other people's code— Vlad Mihalcea (@vlad_mihalcea) August 22, 2020
When you add a library to your project, all the library problems are now your problems as well.— Vlad Mihalcea (@vlad_mihalcea) August 15, 2020
If you ignore the non-functional requirements, you end up with a non-functional product.— Vlad Mihalcea (@vlad_mihalcea) August 20, 2020
Get in touch with my latest articles!
The following StackOverflow answers have been trending over the past two weeks:
- Why does Hibernate disable batch inserts when using an identity identifier generator?
- How to convert a Hibernate proxy to a real entity object
- How to map an entity field whose name is a reserved word in JPA
- How to specify a Primary Key on
- What is the meaning of the CascadeType.ALL for a