If you need to keep a unique and large matrix, I would recommend doing this in a separate table (column / row / value). It will scale better than with a file, and:
- You can easily and easily update individual cells.
- You mentioned using a file to cache your matrix, but if you need to, you can also get your entire table to cache your matrix.
- You can update rows, columns and sub-matrices with well-formed queries.
If you encounter performance issues when increasing the size of the matrix, check out the activerecord-import library. This will help you insert data into your matrix.
source share