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

Add database indices to frequent queries #130

Merged
merged 3 commits into from
Jan 24, 2024

Conversation

abought
Copy link
Collaborator

@abought abought commented Oct 27, 2023

🦑 This PR has not yet been fully tested as part of the release process, but I'm tracking the change so it isn't forgotten.

Purpose

Adds indices to columns that are commonly used as the WHERE clause in DAO queries in this codebase. Some tables, such as downloads, are very large and were performing very inefficient lookups.

This is partial mitigation for the recent database-related downtime incident report (see slack).

How to test this

Build and test release with this migration. Use EXPLAIN <query> to verify that index is being used.

Note: By reviewing the mysql slow query log, I've verified that this should cover most of the common slow query use cases. (downloads table was by far the worst offender across all query types)

abought and others added 3 commits October 27, 2023 10:25
Based on review of WHERE clauses in DAO queries

Partially address recent downtime issue due to DB connection pool saturation
@lukfor lukfor merged commit 674c8da into genepi:master Jan 24, 2024
1 check passed
@abought
Copy link
Collaborator Author

abought commented Mar 6, 2024

No separate code yet, but counters_history (used by dashboard) is also quite slow to load.

I haven't profiled to see if this is due to missing index on dates, or the large volume of data that gets filtered in java. Worth mentioning before I forget.

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 this pull request may close these issues.

2 participants