Re: Counting instances in Core Data
Re: Counting instances in Core Data
- Subject: Re: Counting instances in Core Data
- From: "I. Savant" <email@hidden>
- Date: Tue, 29 Apr 2008 12:08:44 -0400
> Execute a fetch for the entity in which you're interested, and count the
> returned array.
> ________________
>
> My question is: what is the most efficient fetch to pose given that every
> fetch is IO.
Yes.
> A given entity might have a lot of records so an array COULD be an
> unnecessarily large transaction...
Except that, unless you're accessing attributes (which causes the
entire instance to be 'faulted in'), you're only getting an empty,
unpopulated instance - a placeholder ... a fault. It's pretty damned
quick, too (see the many previous 'Core Data performance' related
threads in the list archives).
Resist premature optimization (or 'optimisation' for our European
friends) ... it is the root of all time-wasting evil and a brutal
murderer of all that is precious. Unless of course you're at the
optimization/optimisation faze (fase?) of your project ...
--
I.S.
_______________________________________________
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