简体   繁体   中英

listAll takes long time in Sugarrecord?

I am using sugar record for db in android. I have to fetch all records from table, near about 20000 records in table. It takes time 6-8 seconds. So lenghtly process.

List<Hospital> hospitalList = Hospital.listAll(Hospital.class);

Please help me how can minimize 1-3 sec.

Is it available alternate solution.

Note: We've not been maintaining SugarORM for a while now. I'd suggest you migrate to Android Room. It's a decent library, supported by Google.

If you have to use Sugar ORM, try using the find() methods, which give you access to an iterator. That way, you can control the data load and transformation.

Try to also look for ways you can limit loading of records, eg: pagination. Loading 20000 records at one shot will take some time any way.

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