-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Create desc index #98
Comments
Above didnt really help I also tried but it didnt really help |
Tyring It took 1.26 minutes to make |
Want to try cliustering on horizon_minutes
|
Can you share the query you are trying to optimize? |
The forecast past one |
I thought we could partition the table into horizon_minutes=0 and horizon_minutes>0 |
|
You mean the 2 queries called when this is called? pv-site-api/pv_site_api/_db_helpers.py Line 138 in 411277e
If so I guess the query on past forecasts is the slow one? It's worth noting that the data returned by this query never changes (because it's in the past). As time goes by the only thing that changes is that the latest forecast (which is faster to query, that's the second query in our 2 queries). My point is that instead of calling both queries systematically, we could call the first query once (slow but can be done async and that's typically not what the user is looking for) and then update it with the most latest forecast (which is fast) as they become available. We could even keep the data in the browser cache so that if they refresh it's already there. And if they close their window, come back 30 minutes later, we could just query the missing bit, which would be faster. I'm not sure it's an easy problem to fix otherwise. |
I agree, they might not want that immediately, I'm going to try some partitioning, and see if it helps |
Cool! It could be a good idea to make a separate toy database filled with a lot of (random) data and do tests there, to remove possible external factors, and probably iterate faster. |
Partition from table could be
And then do it in the datamodel I want to try
first |
It sounds dangerous to try those in the Dev/Prod databases. You could end up in a state that alembic doesn't recognize by mistake no? |
This didnt work, Ill role this back. I'm doing it in 'dev', the above meanes I can always role back, never deleting anything |
I made a parititon table and done the renaming, will have to leave it over the weekend to see if it speeds things up or not. |
I rolled the partition back |
It might be sueful to add some index which desc in time. This is becasue we load the most recent data (often)
I`ve tried adding
It took 24 seconds to make
The text was updated successfully, but these errors were encountered: