Skip to content

feat: Safer storage optimization#176

Merged
devsjc merged 2 commits into
mainfrom
devsjc/surer-optimization-migration
Jun 17, 2026
Merged

feat: Safer storage optimization#176
devsjc merged 2 commits into
mainfrom
devsjc/surer-optimization-migration

Conversation

@devsjc

@devsjc devsjc commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Some changes that had been made in the dev database meant the migration did not work. I'm confident it would have been fine in prod, but in order to get it deployed in dev, it needs to be a more defensive migration.

Contribution Checklist

  • Have you followed the Open Climate Fix Contribution Guidelines?
  • Have you referenced the Issue this PR addresses, where applicable?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added a summary of the changes?
  • Have you written new tests for your changes, where applicable?
  • Have you successfully run make lint with your changes locally?
  • Have you successfully run make test with your changes locally?

Warning

PRs may be closed if all the above boxes are not checked.

Some changes that had been made in the dev database meant the migration
did not work. I'm confident it would have been fine in prod, but in
order to get it deployed in dev, it needs to be a more defensive
migration.
@github-actions

Copy link
Copy Markdown

Benchmark Results

Benchmark results
?   	github.com/openclimatefix/data-platform/cmd	[no test files]
?   	github.com/openclimatefix/data-platform/internal/gen/ocf/dp	[no test files]
?   	github.com/openclimatefix/data-platform/internal/interceptors	[no test files]
PASS
ok  	github.com/openclimatefix/data-platform/internal/server/dummy	0.005s
{"level":"debug","time":"2026-06-17T22:50:10Z","message":"Completed migrations"}
goos: linux
goarch: amd64
pkg: github.com/openclimatefix/data-platform/internal/server/postgres
cpu: AMD EPYC 7763 64-Core Processor                
BenchmarkPostgresClient/small/GetForecastAsTimeseries-4         	      45	  24507414 ns/op
BenchmarkPostgresClient/small/GetForecastAtTimestamp-4          	     186	   6337952 ns/op
BenchmarkPostgresClient/small/GetObservationsAsTimeseries-4     	     890	   1279611 ns/op
BenchmarkPostgresClient/small/CreateForecast-4                  	     106	  10865809 ns/op
BenchmarkPostgresClient/small/StreamForecastData-4              	      22	  50672847 ns/op
PASS
ok  	github.com/openclimatefix/data-platform/internal/server/postgres	67.194s
?   	github.com/openclimatefix/data-platform/internal/server/postgres/gen	[no test files]
Benchmark vs base branch
goos: linux
goarch: amd64
pkg: github.com/openclimatefix/data-platform/internal/server/postgres
cpu: AMD EPYC 7763 64-Core Processor                
                                                   │ bench-main.txt │ bench-devsjc-surer-optimization-migration.txt │
                                                   │     sec/op     │        sec/op          vs base                │
PostgresClient/small/GetForecastAsTimeseries-4         22.24m ± ∞ ¹            24.51m ± ∞ ¹       ~ (p=1.000 n=1) ²
PostgresClient/small/GetForecastAtTimestamp-4          6.149m ± ∞ ¹            6.338m ± ∞ ¹       ~ (p=1.000 n=1) ²
PostgresClient/small/GetObservationsAsTimeseries-4     1.256m ± ∞ ¹            1.280m ± ∞ ¹       ~ (p=1.000 n=1) ²
PostgresClient/small/CreateForecast-4                  10.79m ± ∞ ¹            10.87m ± ∞ ¹       ~ (p=1.000 n=1) ²
PostgresClient/small/StreamForecastData-4              51.18m ± ∞ ¹            50.67m ± ∞ ¹       ~ (p=1.000 n=1) ²
geomean                                                9.894m                  10.18m        +2.91%
¹ need >= 6 samples for confidence interval at level 0.95
² need >= 4 samples to detect a difference at alpha level 0.05

@devsjc devsjc merged commit e1da16e into main Jun 17, 2026
4 checks passed
@devsjc devsjc deleted the devsjc/surer-optimization-migration branch June 17, 2026 22:52
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.

1 participant