Using dynamic arrays as column types in psql

152 Views Asked by At

Currently we are planning a new feature that will get several new tables. In summary, its a time series optimization so we split it up into different tasks and store the intermediate results in tables.

So each row represents a center and has one field that is an array - that one basically says how many active drives exist per interval of time, as well as their status. For example it could be that [0] = { normal-drivers: 10, vip-drivers 2, starttime: 00:30 }

Now of course, postgres supports array as column type, and creating a custom TYPE to use as array shouldnt be the issue either.

Considering that we will always retrieve the complete row and only filter by date and center-id, we also dont have to worry about these problems.

My question rather is: These drivers are calculated as predictions. So, for example, if an order is placed for in 2 weeks, we can prepare a prediction and store it. But how does this impact the storage of the rows? If I add a new row, and then another one, the Database would be inclined to append them in the storage space. But then, if the first row grows in size (i.e. because additional drives are added for a different time), it wouldn‘t fit in the same memory space.

0

There are 0 best solutions below