Must have been the fact that I had created the index recently. I tried again a few days later and it worked
Post
Replies
Boosts
Views
Activity
Is there a way to keep this from exponentially increasing?
I can provide the test project if you wish, but it is almost identical to https://github.com/apple/sample-cloudkit-sync-engine
I created a small test project that piggybacks off of the demo CKSyncEngine app (Contacts) and was able to replicate the issue. The contact record only includes 2 fields. The name of the contact and a date field.
I generated exactly 10k contacts with random names (from faker). The local size of 10k records is 27.3 mb (which is already larger than the actual data due to the way it's being encoded as json) once all the records have been uploaded, iCloud reports 75MB.
So I shifted away from NSPersistentCloudKitContainer to CKSyncEngine as i needed more control (the history tracking requirement was one of the culprits)
I have full control over the CKRecords sent to the server now so i know nothing extra is being sent. I'm still seeing a massive increase in usage in CloudKit over the main database. For 13k records, the local database is taking up 2.5MB where CloudKit is reporting 57.6mb