Skip to content

Feat: save db space by storing horizon as ints#2305

Open
nhoening wants to merge 6 commits into
mainfrom
feat/horizon-as-ints
Open

Feat: save db space by storing horizon as ints#2305
nhoening wants to merge 6 commits into
mainfrom
feat/horizon-as-ints

Conversation

@nhoening

@nhoening nhoening commented Jul 12, 2026

Copy link
Copy Markdown
Member

Description

The belief_horizon DB column uses PostgreSQL Interval (16 bytes). Storing seconds as Integer (4 bytes) saves ~12 bytes per row — up to roughly a fifth of total data size.

SeitaBV/timely-beliefs#231 makes the change in the db model, this PR does the FlexMeasures side

  • DB migration from timely-beliefs
  • adaptations in logic (very few)
  • adapt alembic.ini, so we see errors actually in the CLI
  • adapt FM requirements with new timely-beliefs version (only then all tests will pass)
  • Added changelog item in documentation/changelog.rst

nhoening added 6 commits July 10, 2026 11:41
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…onds-level horizons, as queue was not cleared

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@read-the-docs-community

Copy link
Copy Markdown

@Flix6x

Flix6x commented Jul 16, 2026

Copy link
Copy Markdown
Member

Good to note: this PR also effectively changes the minimum/maximum belief horizon from what to what?

@nhoening

Copy link
Copy Markdown
Member Author

Good to note: this PR also effectively changes the minimum/maximum belief horizon from what to what?

To 68 years.

I'm not sure what was possible with 2 or 3 bytes more (I forgot right now how many we save), but it doesn't seem so important. Probably a millenia or even more than that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants