核心数据性能:当所有实体从同一个父实体继承时 [英] Core data performances: when all entities inherit from the same parent entity
问题描述
在我的Core Data数据库中,我的所有实体都继承自父实体。
因此,我刚刚意识到,被添加到1个表(所有实体的表),而不是SQLite中的多个表(每个实体的表)。
我想知道这是否会严重影响
它会影响性能,但多少取决于对象之间有多少共性,有多少对象。如果几乎没有共性,并且你不需要关联的类继承你的托管对象子类,那么使一切都是同一个实体的孩子是不是很有用。使用仪器检查发生了什么。性能问题可能是由其他方面造成的,例如您的抓取请求结构和批量大小。
In my Core Data database, all my entities inherit from a parent entity.
For this reason, I've just realized that, under the wood, all entries are added to 1 table (a table for all entities), rather than multiple tables (a table for each entity) in SQLite.
I'm wondering if this terribly affect performances, since all my data is inserted in 1 table.
thanks
It will affect performance, but how much depends on how much commonality there is between the objects and how many objects you have. If there is little commonality and you don't need associated class inheritance of your managed object subclasses then making everything a child of the same entity isn't very useful. Use Instruments to check what's going on. Performance issues could be caused by other things such as your fetch request structure and batch size.
这篇关于核心数据性能:当所有实体从同一个父实体继承时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!