Re: Validating unique objects in CoreData
Re: Validating unique objects in CoreData
- Subject: Re: Validating unique objects in CoreData
- From: Jerry Krinock <email@hidden>
- Date: Sat, 13 Feb 2010 16:31:31 -0800
On 2010 Feb 13, at 13:51, daniele malcom wrote:
> Hi Roland, in fact indices table exists (for DDArticle entity):
> Enter SQL statements terminated with a ";"
> sqlite> .tables
> ZDDARTICLE Z_METADATA Z_PRIMARYKEY
> sqlite> .indices ZDDARTICLE
> ZDDARTICLE_ZMESSAGEID_INDEX
> ZDDARTICLE_ZPARENT_INDEX
>
> With my macbook pro insertion of 30k articles took about 2/3 minutes.
> I've uploaded a test project:
> http://dl.dropbox.com/u/103260/CoreDataTreeTest.zip
> I really don't know why it should take this long time but using
> Instruments the big part is obviously fetch for searching id and
> parent.
Sorry, I've not downloaded your project yet.
If you're using garbage collection, ignore this. If not, in your previous code, I noticed there was a memory leak in using -newArticleWithID:.
Another silly idea, just for fun, would be to create that predicate in code. I just don't like -predicateWithFormat:. Something like this (untested code):
NSExpression* lhs = [NSExpression expressionForKeyPath:@"messageid"] ;
NSExpression* rhs = [NSExpression expressionForConstantValue:_msgid];
NSPredicate *predicate ;
predicate = [NSComparisonPredicate predicateWithLeftExpression:lhs
rightExpression:rhs
modifier:NSDirectPredicateModifier
type:NSEqualToPredicateOperatorType
options:0] ;
For some real evil, run that query using the sqlite command-line program and see how long it takes :0
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden