listAll takes long time in Sugarrecord?

61 views Asked by At

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.

1

There are 1 answers

1
Satya On

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.