High-Performance Java Persistence Newsletter, Issue 9
Imagine having a tool that can automatically detect JPA and Hibernate performance issues. Hypersistence Optimizer is that tool!
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 published on the Datadog technical blog showing how you can make a PostgreSQL query run 100 times faster by using the VALUES instead of ARRAY with the ANY expression.
If you are using JPA and Hibernate, there’s a very good chance that you need to store Date and Timestamp values. Having so many options on the Java side makes it difficult to choose the right option. For this reason, I wrote the following guide to help you make the right choice.
If you’re using PostgreSQL, then you should know that prepared statements are emulated by default. Only if you are running the same prepared statement more than 5 times will PostgreSQL compile the statement and use a generic plan for it. Unlike Oracle, PostgreSQL does not use adaptive cursor sharing, so the generic plan might not be suitable when using skew data. For more details about this topic, you should check this very good article written by Franck Pachot.
If you’re using MySQL, then you might want to check the following two articles published on the Percona’s blog about removing bottlenecks caused by high traffic:
- 18 Things You Can Do to Remove MySQL Bottlenecks Caused by High Traffic – Part I
- 18 Things You Can Do to Remove MySQL Bottlenecks Caused by High Traffic – Part II
- 18 Things You Can Do to Remove MySQL Bottlenecks Caused by High Traffic – Part III
Another very good article about MySQL is this one, which explains what makes MySQL LRU cache scan resistant.
The one-to-many table relationship is the most common association type. When using JPA and Hibernate, the
@ManyToOne annotation allows you to map the one-to-many table relationship. If you want to see what is the best way to use the
@ManyToOne annotation, check out this article.
Funny, yet useful!
It all started as a joke on Twitter:
When in doubt, just add "vlad mihalcea" to your Google query. pic.twitter.com/WECy0iAgYo— Vlad Mihalcea (@vlad_mihalcea) February 17, 2020
And, Maciej Walkowiak took it further and wrote a tool to search through articles using the command line:
⭐️ The most wanted 😉 CLI for #Java developers is here! ⭐️— Maciej Walkowiak 🍃 (@maciejwalkowiak) May 6, 2020
🧐Search @vlad_mihalcea #hibernate blog content straight from your terminalhttps://t.co/aPDq5Sg59w
Don't forget to put 🔊 on as I found nice soundtrack 😉 pic.twitter.com/cbg6qp8NE2
The background music is worthy of an Oscar.
The 8.0.20 version of MySQL has been released. According to the new versioning scheme, this is not a patch release. In fact, it’s not even a minor release, as the latest versions have brought support for many useful features. The most noteworthy feature offered by the 8.0.20 version is Binary Log Compression. For more details about this release, check out the release notes as well.
There were two releases for the Hibernate ORM project:
I released the 2.9.9 version of the Hibernate Types project, which provides several improvements for Array Types.
The Hibernate Types has now reached over 400k monthly downloads:
Over 400k monthly downloads for the #HibernateTypes project.
— Vlad Mihalcea (@vlad_mihalcea) May 7, 2020
So, if you are not using it already, you should definitely check it out.
Get in touch with my latest articles!
The following StackOverflow answers have been trending over the past two weeks:
- How to get the current database transaction id using JDBC or Hibernate?
- How to persist LocalDate with JPA and Hibernate
- How to a map a TIMESTAMP column to a ZonedDateTime JPA entity property?
- How to use the Java 8 LocalDateTime with JPA and Hibernate
- How to persist OffsetTime and OffsetDateTime with JPA and Hibernate
- Does PostgreSQL run some performance optimizations for read-only transactions