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

Optimize saving nodes and/or links to database #116

Open
smsearcy opened this issue Apr 26, 2023 · 1 comment · May be fixed by #130
Open

Optimize saving nodes and/or links to database #116

smsearcy opened this issue Apr 26, 2023 · 1 comment · May be fixed by #130
Assignees

Comments

@smsearcy
Copy link
Owner

The database updates are taking 5-10 seconds, which is too long (particularly since I've seen a couple of SQLite locking issues recently, which is going to stem from writes locking the database).

Most likely the culprit is the repeated queries to look for the appropriate node/link to update. It is often faster to minimize the number of queries, by preloading more data.

Given the complexity of matching the node, I think the easiest win (and possibly adequate) is to start with optimizing the saving of links.

@smsearcy smsearcy self-assigned this May 8, 2024
@smsearcy
Copy link
Owner Author

smsearcy commented May 8, 2024

Another option is leveraging the bulk update features in SQLAlchemy (although it's likely the queries in a hot loop are more to blame).

https://docs.sqlalchemy.org/en/20/orm/queryguide/dml.html#orm-bulk-update-by-primary-key

@smsearcy smsearcy linked a pull request Jul 25, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant