Skip to content

fix(sql): Faster forecast delete#130

Merged
devsjc merged 1 commit intomainfrom
devsjc/delete-forecast
Mar 5, 2026
Merged

fix(sql): Faster forecast delete#130
devsjc merged 1 commit intomainfrom
devsjc/delete-forecast

Conversation

@devsjc
Copy link
Contributor

@devsjc devsjc commented Mar 5, 2026

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.

Changes in this Pull Request

Updates the DeleteForecast function to better use the index on the PredictedGenerationValues table for speedier deletion.

@peterdudfield
Copy link
Contributor

Good example of here, to use the data-platform api rather than raw sql

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

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-03-05T11:38:41Z","message":"Completed migrations"}
goos: linux
goarch: amd64
pkg: github.com/openclimatefix/data-platform/internal/server/postgres
cpu: AMD EPYC 7763 64-Core Processor                
BenchmarkPostgresClient/2400000/GetForecastAsTimeseries-4         	      54	  21141395 ns/op
BenchmarkPostgresClient/2400000/GetForecastAtTimestamp-4          	      51	  21646177 ns/op
BenchmarkPostgresClient/2400000/GetObservationsAsTimeseries-4     	     938	   1198792 ns/op
BenchmarkPostgresClient/2400000/CreateForecast-4                  	      50	  24370398 ns/op
PASS
ok  	github.com/openclimatefix/data-platform/internal/server/postgres	1312.977s
?   	github.com/openclimatefix/data-platform/internal/server/postgres/gen	[no test files]

@devsjc devsjc merged commit 980ff85 into main Mar 5, 2026
4 checks passed
@devsjc devsjc deleted the devsjc/delete-forecast branch March 5, 2026 12:01
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