核心数据究竟是什么'索引'?(What exactly is 'indexing' in Core Data?)

编程入门 行业动态 更新时间:2024-10-12 22:32:24
核心数据究竟是什么'索引'?(What exactly is 'indexing' in Core Data?)

作为我昨天问过的一个问题的答案( 新核心数据实体与现有问题相同:独立实体或其他解决方案? ),有人建议我索引一个属性。

在谷歌上搜索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.

更多推荐

本文发布于:2023-08-06 09:35:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1446883.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:索引   核心   数据   Data   indexing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!