我有 2 个具有相同数量的表/行的核心数据模型。我刚刚重命名了几行(不添加新行)
核心数据迁移速度是否与已编辑的表行数成正比?还是仅仅取决于数据库有多大?
换句话说,如果我在完全相同的 2 个模型之间迁移(所有字段都被自己保留),迁移应该非常快,还是取决于模型有多大?
谢谢
我已经上传了转换日志:http ://cl.ly/3H1v252R1p1c
附言。不知道为什么我有几行 CREATE/INSERT 语句,即使我没有更改数据库中的任何表。我刚刚在我的数据库中添加了一个新表,但我还没有将它映射到以前数据库中的任何表。
这是代码(我尝试更改所有参数,并删除 pragmaOptions,但它总是很慢。
NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"DBname.sqlite"]];
NSError *error = nil;
NSMutableDictionary *pragmaOptions = [NSMutableDictionary dictionary];
[pragmaOptions setObject:@"OFF" forKey:@"synchronous"];
[pragmaOptions setObject:@"0" forKey:@"fullfsync"];
NSDictionary *storeOptions = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:NO], NSInferMappingModelAutomaticallyOption,
NSSQLiteStoreType, NSStoreTypeKey,
pragmaOptions, NSSQLitePragmasOption,
nil];
persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
[persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:storeOptions error:&error];
UDPATE:可疑重新插入的示例
2013-06-13 09:38:44.114 MyApp[7415:907] CoreData: sql: INSERT INTO ZITEM(Z_PK, Z_ENT, Z_OPT, ZSECTION, ZUNIQUEID, ZBIN, ZDISPLAYNAME, ZSORTNAME) VALUES(?, ?, ?, ?, ?, ?, ?, ?)
2013-06-13 09:38:44.116 MyApp[7415:907] CoreData: details: SQLite bind[0] = (int64)8
2013-06-13 09:38:44.117 MyApp[7415:907] CoreData: details: SQLite bind[1] = (int64)8
2013-06-13 09:38:44.118 MyApp[7415:907] CoreData: details: SQLite bind[2] = (int64)1
2013-06-13 09:38:44.120 MyApp[7415:907] CoreData: details: SQLite bind[3] = nil
2013-06-13 09:38:44.121 MyApp[7415:907] CoreData: details: SQLite bind[4] = 119
2013-06-13 09:38:44.123 MyApp[7415:907] CoreData: details: SQLite bind[5] = 0
2013-06-13 09:38:44.124 MyApp[7415:907] CoreData: details: SQLite bind[6] = "PG-13 (Parents Strongly Cautioned)"