Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • You code looks OK to me; you might need to profile your code to get more information on where the bottleneck is e.g. is it performing the sqlite statement or is it archiving the item? Commented Mar 15, 2010 at 9:53
  • (Though the while(YES) smells a bit - why not just do the request and see what result is - why do you need the while at all?) Commented Mar 15, 2010 at 9:54
  • I was under the impression that the interface might be stuck in the SQLITE_BUSY state for awhile, and that I shouldn't simply proceed until the transaction is actually over. It could possibly be archiving, but I have another transaction that runs a delete query instead, and thats slow too. I'll try running the inserts without encoding the dictionary data and see how it goes. Commented Mar 15, 2010 at 10:04
  • Even without the archiving, a hundred inserts are taking up to 5 seconds to complete. I don't know if this is normal, but at this rate, I'll have no choice but to stuff the whole database module in a thread... Does anyone have a better solution for this? It seems inconceivable that transactions could be taking this long... And sqlite seems to be the only way I can manage large amounts (40+MB) of data without keeping it all in memory at the same time. Core Data doesn't allow me to get rid of objects without loading it into memory first, and uses sqlite as a base anyway. Commented Mar 15, 2010 at 10:12
  • I've suddenly found that I have an even worse problem on my hand. sqlite3_bind_blob is apparently failing for some reason, silently. When I store the blob, the NSData object's length is in the thousands (KB range). When I get it back, it's been truncated to 10 bytes. When I check the DB through SQLite Browser, most of the data is gone (I can recognize the keys in the record if I store the dictionary as NSPropertyListSerialization, but the values are gone). This happens regardless of whether I use NSPropertyListSerialization or NSKeyedArchiver to serialize my data. Commented Mar 16, 2010 at 3:53