1

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

aneuryzm
  • 63,052
  • 100
  • 273
  • 488

1 Answers1

0

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.

Wain
  • 118,658
  • 15
  • 128
  • 151
  • All entities in my core data have a parent entity, because they all share 5 fields. So, in theory, it made sense to use a parent entity, while designing the database. But now I see how it has been a horrible decision, since it seems to slow down the app. Especially when I perform a lightweight migration from an old to a new database, for any small change to any child entity, all the entries must be re-inserted, since core data stores everything in a unique table, matching with the parent entity, which needs to be modified. – aneuryzm Jul 18 '13 at 12:33
  • Yes indeed, that is a costly scenario. – Wain Jul 18 '13 at 12:37