I have max. 600000 Realm objects in my database. I make queries by id(int)=, uuid=, and time(int)<= and the results is ordered by time. Should I use the @Index annotation for some of the fields and maybe change the id from Integer to String? Are the queries going to be slow because I cannot index the time field and cannot have a multiple field index? Would Sqlite better suit my need?
Also, if I'm storing a large number of objects to the database at once, should I use one transaction for all objects or create a new transaction for each objects? How much memory will a large transaction consume and is there a performance hit when creating a new transaction for each object?
The database will be in external storage (memory card) of the Android device.
You should definitely use @Index
on any field that you use in any query.
It greatly improves performance / query speed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With