mardi 4 août 2015

Storing integer arrays in a MySQL database

I have a lot of spectra that I want to store in a database. A spectrum is basically an array of integers with in my case a variable length of typically 512 or 1024. How best to store these spectra? Along with the spectra I want to store some additional data like time and a label, which will be simple fields in my database. The spectra will not be retrieved often and if I need them, I need them as a whole.

For storing the spectra I can think of 2 possible solutions:

  • Storing them as a string, like "1,7,9,3,..."
  • Storing the spectra in a separate table, with each value in a separate row, containing fields like spectrum_id, index and value

Any suggestions on which one to use? Other solutions are much appreciated of course!

Aucun commentaire:

Enregistrer un commentaire