title: Design - JSON Strings storing large amounts of data for large amount of users
body: <p>I wasn't sure if this is the right exchange to post this on, so please let me know if I should move it. </p>
  
  <p>This is more of a design question.</p>
  
  <p>I have a website that allows users to be "tracked" and track their time/work. This involves the users being able to update their account with my site at most every minute, but typically users do it only a few times per day. However, there is nothing stopping other people from updating your account.</p>
  
  <p>Each update creates a datapoint, a snapshot if you will, of their account status and the amount of work they have done.</p>
  
  <p>Users can view the amount of work they have done in the past day or past week. This is done by changing the range of the datapoints you want to see.</p>
  
  <p>My question now, is: There is the very likely chance of having 300k+ users. There are also some user accounts which people follow more closely than others, say, a ceo or a manager, and so those accounts are going to be updated more often. This leads to there being a possible 100k+ data points for a <strong>single user</strong>, within the timespan of only a year or so.</p>
  
  <p>Currently I was thinking of just storing these by the following mapping:</p>
  
  <pre><code>unixtime -&gt; account snapshot
  </code></pre>
  
  <p>This seems like it would be easiest to store as a large json array for a user, for example (with other details I would store):</p>
  
  <pre><code>jsonArray = {
      "alice": {
          "totalHours": 31.6,
          "updates": {
              1515653260 : { work: 95%, hours: 8 },
              1515691399 : { work: 93%, hours: 10 },
              1515695125 : { work: 91%, hours: 7.6 },
              1515698694 : { work: 56%, hours: 6 },
           }
      }
       "bob": {
          "totalHours": 7.32,
          "updates": {
              1515654356 : { work: 95%, hours: 1 },
              1515690342 : { work: 93%, hours: 6.32 },
           }
      }
  }
  </code></pre>
  
  <p>Is this an effective solution? I can't imagine a <code>json</code> string taking up so much space that MySQL wouldn't be able to hold it but I've never dealt with things that are likely to grow this large.</p>
  
  <p>Are there other data structures I could use, or that would be more efficient in grabbing/storing data?</p>
  
  <p>Thanks.</p>