简体   繁体   中英

Fetching Large Set of Mysql Data from Java

My project is in Spring Boot. I need to fetch more than 150k of records in one go. I am using Spring JPA.

However my result Query is giving GC overhead exception in server. Surprisingly when I added a count(*) before fetching the actual records everything is running fine.

I am in search of a proper logical answer

The query count(*) is very light weight query. this will count the record and return the value only. but select query fetches complete data, and here you are fetching 150000 records, which is very very huge, so getting GC overhead exception is obvious.

so,the solution is:
Either optimize your query, or use pagination or use high end server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM