vicky
vicky

Reputation: 109

How to optimize the fetch request from database in web application?

I am developing a web application with spring, hibernate and mysql i would like to know how to fetch data from database very fast. I am trying to select a data from my database. There are thousand of record in my database so its taking more time to select records. I have to know how can i minimize my record fetch time.please give me some suggestion so that i can optimize my web application.

Note : My database has foreign key mapping so i am relating many table to produce final result.

Upvotes: 1

Views: 67

Answers (1)

Pracede
Pracede

Reputation: 4361

To optimize the time of request. You have to use the execution plan. Here is the documentation for MySQL

In general, here are some recommendations to use :

  • Choose the good index. For instance, if you have to choose between Long and String prefer Long.

  • In Select clause just specify field you need.

  • Joins are expensive in terms of time. Make sure that you use all the keys that relate the two tables together and don't join to unused tables -- always try to join on indexed fields. The join type is important as well (INNER, OUTER,... ).

There are some others tips to use but those i list could really improve your time.

Upvotes: 1

Related Questions