feat(postgres): Optimize storage - #175
Conversation
Benchmark ResultsBenchmark resultsBenchmark vs base branch |
This was a field that as of yet wasn't being used. In order to make sure this very large table doesn't take up more storage space than it needs to, I'm removing this dynamic column. Any value-related metadata can live in the forecast metadata, I'm pretty comfident.
|
Just so you know (this PR might still be the right thing to do), that we want to add 5 extras plevels fairly soon, but probably only for National. I assume there is still an option to add this to other_stats_fractions. Also, with this change (and deployment), do we have to update the forecast apps to save to these new columns? |
| pg.horizon_mins, | ||
| pg.p10_sip, | ||
| pg.p50_sip, | ||
| pg.other_stats_fractions, |
There was a problem hiding this comment.
Can we keep this in, so we can easily add new statistics without having to change the data-platform
|
With this current change, nothing has to be updated. P10s and P90s are mapped from the existing other_stats argument in the protobuf, which hasn't been modified. However, new ones won't be saved, as it stands. As I mentioned in the issue write up though, it's really easy to add new columns for P levels. Sure it's a change in the data platform, but it isn't a difficult one. And having 10-20 smallint columns that are mostly null is absolutely fine, and as it turns out, much better for storage than one dynamic column. (In fact, storing 10 P levels in this regard would still take up less than half the storage space of storing just 2 in the jsonb column as before. I think, with storage being a concern, this is the right way to go about things. (It also lends itself much better to columnar compression, if we use that in future!) What are the new levels expecting to be added? I can bundle them in with this change for ease. |
Thanks, makes sense Sorry it could be p2, p10, p25, (and above), but its not really sorted yet. So i would probably not include it in here |
Modifies the schema of the predicted generation values table for optimal storage. Reduces table size by about 40%.
It has been tested thoroughly locally, as well as partially in dev. All looks to work well.
Contribution Checklist
make lintwith your changes locally?make testwith your changes locally?Warning
PRs may be closed if all the above boxes are not checked.
Closes #171