If I need to update data into SQLight constantly , do I need to open new thread?
-
Hi
In my application I have input that im getting from web service , this input translated to 20 units/structures of data .
The representation in the db is , that each unit will be raw in the db .
Now im collecting the data in the memory and I like to insert this data in db .
What strategy will be the best?
To open thread in the background that will handle the inserts ,
If yes , what she'll be the best and less cpu/memory hungry . insert raw by raw or to insert chancks of 20 raw in each insert ?
I want this operation to be as much as silent and not noticeable by the user -
It depends on how often that input will come in. If it's only sparse, you can do it in the GUI thread, I would say. Else, I would move it to a separate thread. In a thread it wouldn't make that much different if you insert one by one or in chunks.
But there is no "best strategy", such things always depend on the actual use case.