spring-projects / spring-projects/spring-data-relational

Spring Data JDBC performance by caching SQL statements generated for derived queries.

Open
#1,106 12 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
827
Forks
394
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ProductRepository findByName example and reproduce the JMH comparison between Spring Data JDBC and Spring Data JPA using H2. Investigate how derived-query SQL statements are generated and whether caching is involved. Done should mean explaining the performance difference or identifying a concrete configuration or implementation change, but the issue does not name source files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, databases, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.