Search code examples
iosobjective-crealm

Realm index and primary key


I think I have read it somewhere which say that primaryKey in realm object is indexed.

However, if I manually declare indexedProperties does this override index on primaryKey and I need to manually include primaryKey to the indexed list?

The document here doesn't say anything about this.


Solution

  • Katsumi from Realm here. A primary key property will be indexed automatically.

    See https://github.com/realm/realm-object-store/blob/a7edffdec9795d3371838daf2b14641d72825698/src/property.hpp#L51

    So you do not need specify indexed if the property is primary key. But there is no problem/effect specifying both indexing and primary key.