Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix slow CSV exports #845

Merged
merged 2 commits into from
Nov 9, 2019
Merged

Conversation

Pikrass
Copy link

@Pikrass Pikrass commented Oct 6, 2019

CSV exporting was taking tens of minutes on my phone, for only around 120 exported transactions, and a database containing 2 years worth of personal finances.
This PR fixes it. Technical details are in commit messages, but basically: the code fetched all transactions from one account for every single exported split. That meant easily tens of thousands or even hundreds of thousands requests for one export.

For each split in every exported transaction, the code fetched the whole
Account instance, including all its transactions with all their splits.
This resulted in hundreds of thousands of requests with a medium-sized
ledger.

There was a cache mechanism, but it was local to one single transaction,
thus essentially useless.

Now, each split generates two requests, to get the account's name and
full name. A better cache mechanism would speed this up further.
Caching allows us to decrease the number of database requests. We did
two requests per exported split before this commit; now we only do two
requests per unique account in all splits.
@codinguser
Copy link
Owner

Thanks!

@codinguser codinguser merged commit 9b1851a into codinguser:develop Nov 9, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants