• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data troubles - not removing objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data troubles - not removing objects


  • Subject: Re: Core Data troubles - not removing objects
  • From: Chris Hanson <email@hidden>
  • Date: Thu, 1 Nov 2007 19:04:31 -0700

On Nov 1, 2007, at 3:53 PM, Benjámin Salánki wrote:

The sqlite database file format won't grow and shrink in response to every change you make, for performance reasons data is mapped to pages which may contain many individual data records (or a single data record can span many pages).

So are you saying removing an item from the store won't reduce its size on the disk? How can I tell my users that even if they do remove all their data they won't regain any of their precious hard disk space? Surely there has to be a way to reduce the size of the file if I remove data from it. PLease tell me it's possible.

You asked about removing *an* item. If enough items are removed to free up a page in the database file, SQLite's automatic database vacuuming will reduce the size of the file as it rearranges the data to remove that page. Similarly, the file size may be reduced if you remove an item that itself occupies multiple pages (such as a thumbnail image).


An SQLite file is arranged as a collection of pages and the data within those pages is managed via B-trees, not as simple fixed-length records (which is what it sounds like you're expecting). This is much more efficient for searching and for overall storage, since it allows SQLite to optimize how it stores both data and indexes in a single file, and is also the foundation of its data integrity (transaction & journaling) mechanism.

However, the cost of this is that some delete operations may leave holes in the file. If you delete some data and add other data, the holes left by the deleted data may be filled by the added data, or the file may be vacuumed to compact its data, whichever SQLite considers most appropriate based on the operations you're performing.

Does that make sense?

  -- Chris

_______________________________________________

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


  • Follow-Ups:
    • Re: Core Data troubles - not removing objects
      • From: Benjámin Salánki <email@hidden>
References: 
 >Core Data troubles - not removing objects (From: Benjámin Salánki <email@hidden>)
 >Re: Core Data troubles - not removing objects (From: Adam Swift <email@hidden>)
 >Re: Core Data troubles - not removing objects (From: Benjámin Salánki <email@hidden>)

  • Prev by Date: Re: CGDisplayBounds() with stacked displays...
  • Next by Date: Re: [NSOutlineView outlineView:isGroupItem] rendering issue
  • Previous by thread: Re: Core Data troubles - not removing objects
  • Next by thread: Re: Core Data troubles - not removing objects
  • Index(es):
    • Date
    • Thread