How to improve Hibernate performance in Java?

I have thousands of records that you need to get with a single click on the user. Currently it gives me results very slowly, I have to wait a long time. Is there a way to improve getting these results using sleep mode?

I have a case where a method that has a select request will execute every minute. Here hibernate gives me a slow result. I am using Hibernate with MySQL.

+6
source share
2 answers

It is common practice to use a second level cache and a request cache. Than your data will be read from memmory not from db.

Good article about it here.

Other things may be helpful:

1 Indexing - in case there is an order - you need to create indexes for the fields you are looking for / ordering - this can improve the search speed by 10 times

2 Denormalization - if you have many associations, some denormalization may help (putting only one table). But this should be the final decision when everything else does not work.

+6
source

I suggest you switch to Pagination if you need to display the records on a web page and get some of the records at a time, say 100.

+1
source

Source: https://habr.com/ru/post/916654/


All Articles