Am working in a project where retrieving data from database takes time since the number of records are more than 2000 .
Am using JPQL to query the database and display it in JQGRID .
Can any one suggest or guide me how to query huge amount of data from database which takes less time .
I am happy to provide any kind of extra information needed
Also please guide me if there is already a solution ….
Thank you ….
The first thing you need to do is profile your query to see where your time is being spent. 45 seems like an insane amount of time to read 2,000 records. On a simple desktop I can read over 10,000 simple objects in less than 1 second. Are your objects very complex?
You might want to enable logging as a start, it could be your time is being spent fetching relationships, (the n+1 problem).
If you are using EclipseLink you can enable the PerformanceMonitor, it can give you a profile dump of where your time is being spent. Using a Java profiler such as JProfiler would also be good.
See also,
http://java-persistence-performance.blogspot.com/2011/06/how-to-improve-jpa-performance-by-1825.html