Best way to store an array in MySQL database?

后端 未结 3 1709
没有蜡笔的小新
没有蜡笔的小新 2020-12-30 23:52

Part of my app includes volume automation for songs.

The volume automation is described in the following format:

[[0,50],[20,62],[48,92]] 

3条回答
  •  一生所求
    2020-12-31 00:29

    If speed is the most important when retrieving the rows then make a new table and make it dedicated to holding the indices of your array. Use the data type of integer and have each row represent an index of the array. You'll have to create another numeric column which binds these together so you can re-assemble the array with an SQL query.

    This way you help MySQL help you speed up access. If you only want certain parts of the array, you just change the range in the SQL query and you can reassemble the array however you want.

提交回复
热议问题