dassouki
dassouki

Reputation: 6366

Building a database to store matrices in SQLite

In a database for an engineering simulation forecasting application:

Question

What is the best practice way to design/build/store such a database (especially the matrices) and what are some of the design/implementation issues you might foresee?

Upvotes: 0

Views: 1408

Answers (1)

Holger
Holger

Reputation: 1859

I think that matrices are usually represented as adjacency lists in the relational model. That means that you have one column for every dimension of the matrix containing the coordinates and one (or multiple) columns for the value in that cell.

This should allow efficient querying but you should avoid iterating through the matrix using point-queries (i.e., requesting the value in a single cell). If possible, you should encode as much of your algorithm in (ansi/cursor-free) sql and have the DBMS execute it.

If that is not possible you would end up reading the whole matrix (or the needed chunks) from the database, perform the algorithm and write it back. If you come to this point you might want to ask yourself if a relational database is what you need.

Upvotes: 1

Related Questions