How Photos Actually Stores Data
The iPhone Photos app uses a SQLite database (Photos.sqlite) that tracks every image's metadata, albums, edits, faces, and moments, separately from the actual image files stored in the /DCIM directory. This two-layer architecture means you can have 10,000 photos with instant search, facial recognition, and album membership without loading every file. The database is what makes Smart Albums, Memories, and search work. When iCloud Photos is on, the database also tracks which originals are on-device versus in the cloud. Swype Photo Cleaner respects the standard Apple APIs, so every delete properly updates the database and syncs correctly.
The Two-Layer System
iPhone photos live in two places. First, the actual image files (JPG, HEIC, MOV, etc.) are stored in a protected location that mirrors the DCIM camera folder structure. Second, the Photos app maintains a SQLite database (photos.sqlite) that indexes everything and stores all the metadata that makes Photos feel fast.
Without the database, the Photos app would have to read every file individually to know what is in your library. That would take minutes per launch on a typical library of 20,000 photos.
What the Database Stores
The database holds:
- Capture date, time, and location (from EXIF).
- Album membership (which photos are in which albums).
- Favorites, hidden status, deletion status.
- Face recognition clusters (the People album).
- Moments and memories groupings.
- Edit history and non-destructive adjustments.
- iCloud sync status per photo.
- Caption, keywords, and user tags.
Why Edits Are Non-Destructive
When you crop, filter, or adjust a photo, the original file never changes. The database records your edits as instructions layered on top of the original. Tap Revert and the instructions are discarded, revealing the untouched file. This is how Apple lets you experiment without risk.
How Deletion Works
Deleting a photo does not immediately remove it. The database flags the photo as deleted and moves it to the Recently Deleted album. After 30 days, or when you manually empty the album, the database entry is removed and the underlying file is unlinked for deletion. If iCloud Photos is on, all of this syncs across devices.
Tools like Swype Photo Cleaner use Apple's PhotoKit API to handle deletions the proper way, so the database stays consistent and nothing breaks.
Database Corruption and Rebuilding
Occasionally the database can get out of sync or corrupted. Symptoms include photos that will not load, broken thumbnails, infinite loading spinners, or incorrect storage calculations. iOS includes a rebuild mechanism: hold Option while opening Photos on Mac, or on iOS, delete and reinstall the Photos app (not possible directly; a system restore works).
Knowing this architecture helps you understand why Photos behaves the way it does and why some operations feel fast while others (first-time face indexing, iCloud initial sync) take hours. It is not magic, it is just a database.