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

Log slow MySQL queries on CI #6049

Merged
merged 1 commit into from
Feb 21, 2022
Merged

Conversation

ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented Feb 18, 2022

To help us with #5835

Signed-off-by: Christoph Wurst <[email protected]>
- name: Enable slow mysql query logs
if: ${{ matrix.db == 'mysql' }}
run: |
echo "SET GLOBAL log_queries_not_using_indexes = 1;" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
Copy link
Member Author

Choose a reason for hiding this comment

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

on CI queries aren't slow enough to trigger a slow query as per https://mariadb.com/kb/en/slow-query-log-overview/, so I've added this line to show anything that doesn't use an index.

Copy link
Member

Choose a reason for hiding this comment

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

Any clue if that shows queries where an index exists but is not used because it matches 90% of the rows anyway and stuff like this?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is indeed the case. So if your tests clear a table with DELETE FROM xyz it will show up.

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

Clever 👍
Hopefully you don't get too much false positives

Copy link
Contributor

@miaulalala miaulalala left a comment

Choose a reason for hiding this comment

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

Great idea! :shipit:

@ChristophWurst ChristophWurst merged commit 23a9ce3 into main Feb 21, 2022
@ChristophWurst ChristophWurst deleted the chore/mysql-slow-query-logs branch February 21, 2022 16:33
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.

3 participants