Skip to content

[DBMON-5463] Switch sql index query resolution over to a static version check #20514

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

Merged
merged 2 commits into from
Jun 16, 2025

Conversation

eric-weaver
Copy link
Contributor

What does this PR do?

Avoids a query to INFORMATION_SCEMA.COLUMNS that's currently made when schema collection is enabled. This query currently gets executed one time per 500 tables in a schema per check run to determine if a column exists for a subsequent query for index usage information. The EXPRESSION column was added in mysql 8.0.13 as noted in information_schema.columns docs and MariaDB does not support this so we can statically check the version and flavor to determine which query we should run

Motivation

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@@ -169,8 +167,7 @@ def _cursor_run(self, cursor, query, params=None):
@tracked_method(agent_check_getter=agent_check_getter)
def _fetch_database_data(self, cursor, start_time, db_name):
tables = self._get_tables(db_name, cursor)
tables_chunks = list(get_list_chunks(tables, self.TABLES_CHUNK_SIZE))
for tables_chunk in tables_chunks:
for tables_chunk in get_list_chunks(tables, self.TABLES_CHUNK_SIZE):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_list_chunks is a generator function that yields chunks of TABLES_CHUNK_SIZE lists. This is a tiny refactor that will avoid immediately generating a new list of chunk lists and instead generate the chunks from the tables list on each loop

Copy link

codecov bot commented Jun 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.27%. Comparing base (5aa512c) to head (1268f6e).
Report is 15 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
activemq ?
cassandra ?
confluent_platform ?
hive ?
hivemq ?
hudi ?
ignite ?
jboss_wildfly ?
kafka ?
mysql 89.30% <100.00%> (+<0.01%) ⬆️
presto ?
solr ?
tomcat ?
weblogic ?

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eric-weaver eric-weaver added this pull request to the merge queue Jun 16, 2025
Merged via the queue into master with commit 29d756d Jun 16, 2025
23 checks passed
@eric-weaver eric-weaver deleted the eric.weaver/DBMON-5463 branch June 16, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants