4 ms·
I found this project on Github a few weeks ago and have been quietly following it. It looks really cool but I didn’t get from the readme how I would best take
by jarym 8y ago
I found this project on Github a few weeks ago and have been quietly following it.
It looks really cool but I didn’t get from the readme how I would best take my relational tables and make a set of matrices from them.
I’ll take another look this weekend
- michelpp 8y agoMatrices are constructed from arrays of rows, columns, and values. The simplest way to pivot a table into a matrix is to use array_agg() select matrix(array_agg(row), array_agg(col), array_agg(val))) from table; For the inverse operation there are set returning functions called 'matrix_elements_<type>(m)' which return the graph elements as row tuples. From a table management standpoint, matrices are varlena objects much like arrays. Triggers can be used to call set_element() to keep matrices and tables sync'ed, although like arrays, this has a high re-serialization cost for large arrays. Because of this it's best to modify matrices in bulk operations.