Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up get all pvlive data #259

Closed
Tracked by #267
peterdudfield opened this issue Aug 10, 2023 · 1 comment
Closed
Tracked by #267

Speed up get all pvlive data #259

peterdudfield opened this issue Aug 10, 2023 · 1 comment
Assignees

Comments

@peterdudfield
Copy link
Collaborator

peterdudfield commented Aug 10, 2023

Current getting all the pvlive data takes a long time

nowcasting_api | 
{
    "message": "Process Time 7.336811304092407 http://api-dev.nowcasting.io/v0/solar/GB/gsp/pvlive/all?regime=in-day",
    "filename": "main.py",
    "lineno": 193,
    "level": "debug",
    "timestamp": "2023-08-10T09:20:35.687923Z"
}
SELECT DISTINCT ON (location.gsp_id, gsp_yield.datetime_utc) * FROM location 
JOIN gsp_yield ON location.id = gsp_yield.location_id
WHERE location.id = gsp_yield.location_id 
AND gsp_yield.regime = %(regime_1)s 
AND gsp_yield.datetime_utc >= %(datetime_utc_1)s 
AND gsp_yield.solar_generation_kw + %(solar_generation_kw_1)s > gsp_yield.solar_generation_kw 
AND location.gsp_id IN (%(gsp_id_1_1)s, %(gsp_id_1_2)s, %(gsp_id_1_3)s, %(gsp_id_1_4)s, %(gsp_id_1_5)s, %(gsp_id_1_6)s, %(gsp_id_1_7)s, %(gsp_id_1_8)s, %(gsp_id_1_9)s, %
...
(gsp_id_1_310)s, %(gsp_id_1_311)s, %(gsp_id_1_312)s, %(gsp_id_1_313)s, %(gsp_id_1_314)s, %(gsp_id_1_315)s, %(gsp_id_1_316)s, %(gsp_id_1_317)s) 
ORDER BY location.gsp_id, gsp_yield.datetime_utc DESC, gsp_yield.created_utc DESC
@peterdudfield peterdudfield added enhancement New feature or request and removed enhancement New feature or request labels Aug 10, 2023
@peterdudfield peterdudfield self-assigned this Aug 10, 2023
@peterdudfield
Copy link
Collaborator Author

Seems like the query only takes 1 second, but another 5 seconds to deliver the data

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

No branches or pull requests

1 participant