What does the Indexed Property of a CoreData attribute do?

前端 未结 2 1350
旧巷少年郎
旧巷少年郎 2020-12-15 02:56

I have a Core data model with a 32bit hash value. I need to look up specific hash values quickly. Should I use the indexed property? I have no idea what it does and the d

2条回答
  •  星月不相逢
    2020-12-15 03:13

    I would recommend to read this on indexes: http://en.wikipedia.org/wiki/Index_(database). 

    Simply put, a database engine creates a new structure which keeps the indexed column (which corresponds to a property) sorted and a link to the corresponding row for each entry (primary key). This allows for faster searches (since search in ordered lists is faster than in unordered lists). But this increases used storage (for the data structure), and insertion times (to keep the structure sorted).

    So yes, you should use indexes in such cases.

提交回复
热议问题