Note that there are some explanatory texts on larger screens.

plurals
  1. POSQLite vs Memory
    primarykey
    data
    text
    <p>I have a situation with my app.</p> <p>Suppose I have 6 users, each user can have up to 9 score entries (i.e score 1000 points at 8:00pm with gold collected 3, silver 4 etc etc), say score per stage and 9 stages.</p> <p>All these scores are being taken from an API call, so it can update with an interval of 3+minutes.</p> <ul> <li>Operations I need to do on this data is <ul> <li>find the nearest min, max record from stage 4.</li> <li>and some more operations like add or subtract two scores etc</li> </ul></li> </ul> <p>All these 6 users, and their score records are already in database, being updated in needed after the API call.</p> <p>Now my questions is :</p> <p>Is this a better way for such kind of data (data of scores here) to keep all the data for all the 6 users in memory in NSArray or NSDictionary, and find min and max in that array by a min-max algorithm.</p> <p>OR</p> <p>It should be taken from Database by a query like " WHERE score&lt;=200 " AND " WHERE score >=200", in short, 2 database queries which return nearest min and max record each, and not keeping all the data in memory.</p> <p>What we are focusing on is speed, and memory usage both. The point is, Would a DB call be fast and efficient to find min and max OR a search for min,max in an Array of all the records from DB. All records can be 6users * 9scores for each = 54. Update time for records can be 3+ minutes. Frequency of finding min max for certain values are high.</p> <p>Please ask, if any more details are required. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload