Closed benbonnet closed 10 years ago
Like any long running tasks, writing to database should not run in the main thread. One way to do it is create a private background queue and only write databases on the queue. Note every update to UIKit must be done on main thread, so you need to be careful.
Some references:
perfect, thanks for this reply. to be clear, a "create" query can be considered as a long running task, while a "select" one is not ?
It really depends on your use case. If you have millions of records, a #find could be slow. A simple #find_by_key should be relatively fast in most case.
I'm using the nanodb with ruby motion to store data locally. As you use the app, remote services are called once in a while, data saved in the db.
It does grow with time (as any db would do), but for a thousand entries the app got quite stuck on the ui side while creating models. Surprisingly, the finds queries are pretty stable.
I would be glad to get some feedback on what's happening, if you see something right here best