Database

Aperture: An Inconsistency In Your Database Has Been Detected

Brett Gross recounts his experience tackling the message from Aperture: An inconsistency in your database has been detected.

He did all the right things. He immediately made a back up of the library. Then he tried repairing the problem. When that didn't work, he broke the problem down and solved one part at a time. After he had some success, he made another back up in addition to the first. Eventually he found what was causing the problem, deleting the offending files, and all was well.
|

Safari 3 Stores Web Icons In A Database

I notice that since upgrading to 10.4.11 (still not running Leopard here), Safari no longer stores its web icons in files. Instead it uses a SQLite database. This is a feature of the new version of Safari. My ~/Library/Safari folder looks like this:
safariwebicons1
I can use SQLite Database Browser to see what is inside:
safariwebicons2
Safari used to get slower and slower maintaining a huge folder tree of tiny web icons: I used to delete mine every so often to clear them out. This solution should cut down on disk space use and be much faster after months of browsing.
|

Aperture: Speed Up Aperture By Rebuilding The Database Index

databasereindexicon
Everyone is excited about the discovery of using the sqlite vacuum command to rebuild the index for Mail.app. Well the same trick works for Aperture. Rebuilding the library database indexes is much faster than rebuilding the entire database. While probably not as effective, it does improve the speed of Aperture, especially for heavily-used libraries with a lot of deleted images. [Update: Aperture 2.0 has two databases: the Aperture.apdb database and a new one called BigBlogs.apdb. As currently written, this script does not touch the BigBlobs database.]

Here is the script. You can download a ZIPped version from the download page or paste the text below into Script Editor. Be careful of the single- and double-quotes getting modified in the process. They are all straight quotes. [Update: I added an improvement sent to me by Adam Tow. The script now only opens bundles and defaults to the Pictures folder.]

tell application "Aperture" to quit

set new_file to choose file with prompt "Select Aperture Libary to compact its database" default location (path to pictures folder) of type {"BNDL"}
set libname to (POSIX path of new_file) & "Aperture.aplib/"
set dbname to libname & "Library.apdb"
set sizeBefore to do shell script "ls -lah " & (quoted form of libname) & " | grep -E 'Library.apdb$' | awk {'print $5'}"

do shell script "/usr/bin/sqlite3 " & (quoted form of dbname) & " vacuum"

set sizeAfter to do shell script "ls -lah " & (quoted form of libname) & " | grep -E 'Library.apdb$' | awk {'print $5'}"

display dialog ("Database before: " & sizeBefore & return & "Database after: " & sizeAfter & return & return & "Now try it out!")

After prompting to select an Aperture library, it runs for a while (up to a minute on large libraries) and then shows a dialog box comparing the size of the library database before and after processing:
databasereindex
Let me know how much it helps.
|

Inside The Aperture Library Database

I found this article that delves into the SQLite database that lies inside the Aperture library. There are other Aperture articles on this site on performance, and downsampling.
|
The Bagelturf site welcomes Donations of any size