Saturday, 31 August 2013

How to store HUGE arrays, for graphs

How to store HUGE arrays, for graphs

The data, created in Javascript, with use of jQuery:
1.) Users answer multiple-choice questions, of which the time it takes to
answer (tX in ms) is stored, by adding it to an array (answerTimes).
2.) Also, it is recorded whether or not the question was answered
correctly (cX in binary), which is stored into an array as well
(answerCorrects (I know; it's a shit name. Deal with it)).
e.g.,:
var answerTimes = [];
var answerCorrects = [];
// for every answer:
answerTimes[answerTimes.length] = tX
answerCorrects[answerCorrects.length] = cX
// which results in, e.g.:
// answerTimes = [1289, 1784, 1628, 972] and
// answerCorrects = [0,0,0,1,1,0,1,1,0], both of variable length,
// depending on how many questions the user has answered.
// this could well be over a thousand answers!
And here's the thing:
These are multiple graphs (such as, but not limited to these 2) per chapter.
There are also multiple chapters, per subject.
There are also multiple subjects, per language.
And there are multiple languages.
e.g., a user who is learning Japanese, and is currently studying his
Kanji, and is at chapter 4, wants to review his performance data,
presented in the form of graphs.
The actual question:
What fashion would be best to work in, in order to store these various
arrays in a MySQL database, assuming I'm using AJAX to pass these
JS-values on to a PHP that does the MySQL magic?
I'm worried, because if there were to be 1 user, 3 languages, 10 subjects,
7 chapters, and 2 graphs, then there would already be an incredible number
of arrays to store. However these small numbers aren't what I'm aiming
for: I want as many users as the market allows me, with as many languages
as there are - even ancient ones, no /joke here - and these numbers will
continue to expand as time goes by. I want users to be able to learn ANY
language possible, and to have as MUCH graphical information about their
performance as possible to their disposal.
How the hell am I supposed to store ALL of this data in an organised way,
that my script can access these arrays. I know how to work mySQL, but I've
never had anything more than some strings and serialised, small arrays to
store. Also; how to graph them, I know, it's just the storage part of
these huge and many arrays that bothers me.
Hit me!

No comments:

Post a Comment