-
Notifications
You must be signed in to change notification settings - Fork 1
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
Transactions CSV (and Excel) is slow: Avoid repeated queries #346
Comments
Performance boost to /api/1/access/transaction.csv #346
First pull request done. However there is more we might be able to do here, there are still secondary SQLs happening. In particular, activity is joined to the main transaction SQL just for sorting then not selected, so secondary SQLs are made to load the activity later! Adding |
#350 speeds up by_sector & by_country. When doing the by_country one, there are still a lot of SQL fetches for individual organisations. Maybe there is another quick speed up possible here. |
Describe the bug
Transactions CSV (and Excel) is slow
Issue
For every hit on the transaction, we get lots of individual DB queries:
Those 3 queries are repeated heavily.
These python functions get the extra data:
There are also some queries to get extra info on
organisation
,participation
andactivity
tables that did not repeat in my test data set (I think because SQLLachemy caches?), but should repeat on larger data sets.Possible solutions
These actual DB queries are really fast as you can see above, but they do add up and there are a lot of them.
If we are lucky some joining on the original query to avoid later queries will really boost this.
The text was updated successfully, but these errors were encountered: