1. Mes's Avatar
    My AddressBook and Calendar databases are well-used. After a month or 2 of usage I noticed thay each grown to well over 1MB. Being a curious individual, I embarked upon a task to see if they could be optimized. Yes they can

    The best solution (if you sync Contacts and Calendar with iTunes):
    1) Do a complete sync w/iTunes
    2) Use WinSCP and rename the databases to something you'll remember (like -old, or -original):
    cd /private/var/mobile/Library/AddressBook
    mv AddressBook.sqlitedb AddressBook.sqlitedb-orig
    mv AddressBookImages.sqlitedb AddressBookImages.sqlitedb-orig
    cd /private/var/mobile/Library/Calendar
    mv Calendar.sqlitedb Calendar.sqlitedb-orig
    3) Respring
    4) From iTunes / Info / (Advanced - bottom of page) --- check the following boxes:
    Replace Information on this Phone
    -- Contacts
    -- Calendar
    5) Sync

    iTunes will rebuild the databases completely from scratch. My database files reduced by 50+% .

    WARNING: If you forget to check Replace Information (Contacts and Calendar check-boxes) on this iPhone , you computer database may get wiped out completely. Take heed !!!!

    Note1: If you don't delete the database on the iPhone, it will not be rebuilt (only sync'd using the computers as the master)--- even if you check the 'Replace Info' boxes.
    Note2: If something goes amiss, you have the original databases saved (-orig). Safety 1st
    Note3: Don't expect any noticeable performance improvement unless your database is greater then 1MB.

    Option #2:
    You could use sqlite3 on your computer to manually ".dump", then reload the database then put back on the iPhone. Works about the same --- I prefer the iTunes method as I assume it is more dependable and reliable.
    Last edited by Mes; 2009-08-13 at 02:01 AM.
    2009-08-13 01:55 AM