作为我昨天问过的一个问题的答案( 新核心数据实体与现有问题相同:独立实体或其他解决方案? ),有人建议我索引一个属性。
在谷歌上搜索SQLite /核心数据中的“索引”之后,我恐怕不能确切地知道它是什么或者它如何根据属性加速获取。 请记住,除了过去几个月基于读取方式,方式,方式,过多关于核心数据的模糊想法之外,我对SQLite /数据库一无所知。
As an answer to a question I asked yesterday (New Core Data entity identical to existing one: separate entity or other solution?), someone recommended I index an attribute.
After much searching on Google for what an 'index' is in SQLite/Core Data, I'm afraid I'm not closer to knowing exactly what it is or how it speeds up fetching based on an attribute. Keep in mind I know nothing about SQLite/databases in general other than a vague idea based on reading way, way, way, too much about Core Data the past few months.
最满意答案
简单地说,索引是一种预先分类。 如果您有数字属性索引,则商店按数字顺序维护链接列表。 如果您有文本属性,它会按字母顺序维护链接列表。 根据算法,它还可以维护有关属性的其他类型的信息。 它将数据存储在附加到持久性存储文件的索引中。
它使基于索引属性的提取更快,更大的文件大小和稍慢的插入。
Simplistically, indexing is a kind of presorting. If you have a numerical attribute index, the store maintains linked list in numerical order. If you have a text attribute, it maintains a linked list in alphabetical order. Depending on the algorithm, it can maintain other kinds of information about the attributes as well. It stores the data in the index attached to the persistent store file.
It makes fetches based on the indexed attribute go faster with the tradeoff of larger file size and slightly slower inserts.
更多推荐
发布评论