Speed of search operation in a Realm database

后端 未结 1 1102
伪装坚强ぢ
伪装坚强ぢ 2021-01-25 19:17

This is the model for my RealmObject class :

    public class ARDatabase extends RealmObject
    {
    @PrimaryKey
    private String uid;

    priv         


        
1条回答
  •  别那么骄傲
    2021-01-25 19:48

    Doing the search in Realm will always be faster since you can execute the entire search inside the C++ core. Doing the search yourself will mean you occur the overhead of going back and forth between Java and C++.

    The only requirement for doing fast searching for single elements is that you have an @Index annotation on the field, but in your case you already have @PrimaryKey which automatically applies the @Index annotation as well.

    So your query is as fast as it can be. Besides, for 10-100 objects, no matter what you do, it will probably appear instantaneous to the user.

    0 讨论(0)
提交回复
热议问题