question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spring Data JDBC performance

See original GitHub issue

Hi

We have a Spring Data JPA (Hibernate) project that we would like to migrate to Spring Data JDBC. The main reasons are simplified configuration and model mapping. And we thought that it would lead to better performance.

However we did some benchmarks (with default settings) using JMH (H2 database) and it turned out that in most cases the performance has decreased. For example, we have the following repository and query method:

public interface ProductRepository 
	extends CrudRepository<Product, Integer> {
	
	Product findByName(String name);

And the benchmarks showed the following execution time (in ns): Spring Data JDBC - 80899 Spring Data JPA - 14124

So is it predictable? Or we missed something in our configuration/tests?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
petromircommented, May 30, 2022

It seems, we also do not properly cache the results of constructing the SQL statement from the method name, resulting in some significant overhead. You can workaround that by providing an explicit query. The missing caching is something we’ll fix.

@schauder Is this something to expect in the upcoming version 3.0?

0reactions
schaudercommented, Jan 17, 2022

Was it done intentionally? Yes and no. I intentionally added the annotation to demonstrate the effect of not caching the generated query. Changing the query semantics was a mistake on my side.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Data JDBC performance · Issue #1106 - GitHub
Hi We have a Spring Data JPA (Hibernate) project that we would like to migrate to Spring Data JDBC. The main reasons are...
Read more >
Spring Data JPA vs Data JDBC — Evaluation - Medium
Let's start with the positives. It is very clear that Spring Data JDBC out performs its counterpart in these tests and gives a...
Read more >
Spring Data JPA to Spring Data JDBC – a smooth ride?
Spring Data JDBC API is like Spring Data JPA, but still, it is a different framework. First, we need to review our data...
Read more >
Spring Data JDBC / Spring Data JPA vs Hibernate
The main advantage of Spring data JPA is the query support, but querydsl is also a nice option. In both case it requires...
Read more >
A Comparison Between JPA and JDBC - Baeldung
4.5. Performance ... The difference between JPA and JDBC is essentially who does the coding: the JPA framework or a local developer. Either...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found