hail
hail copied to clipboard
[batch] Use the new aggregated by date billing tables
Stacked on #12006
This PR actually uses the new tables within the client application. The billing page should now load quickly. Note that the old aggregated billing tables are still in the database and being populated.
The key thing to note is I switched how we are computing the cost. First, I aggregate the usage by resource before multiplying by the resource rate and summing. Therefore, the old and new numbers should be close, but not identical in the UI.
The reviewer should double check that there are no references to aggregated_*_resources$
tables (the ones that do not have the date interval) within the application code.
cc: @danking
I checked all the queries are fast now even with the common table expressions.
I'll retry the PR Monday morning. Let's not merge on a Friday.