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
slow SQL query using MariaDB causing high CPU load #15588
Comments
Make sure this index exists in the This should be fast and sending data should be fast. This sounds more like an issue with your DB server and maybe something for the forum: https://forum.matomo.org/ Maybe there are some visitors with heaps of visits? But then the query should be still fast. Maybe try something like
|
Hi @tsteur, thanks for your time. Below the indexes that are in log_visit table. Below is the output of the query (i change it to a limit 20). It take 122.844 sec to end. Thanks! |
@tpimpao This query should not take that long even if it had to look at 1000 visitor rows. I wonder if MySQL maybe picks the wrong index and uses the Are you familiar with PHP? Could you try adding a new line here https://github.com/matomo-org/matomo/blob/3.13.2/core/Tracker/Model.php#L421 like this:
|
Hi @tsteur 🥇 , very good news!! 👍 But, why this happen? There are any good reason for MySQL picking the wrong index? Thanks, |
Hi again @tsteur ,
Forcing the index in the query:
Thanks, |
Awesome, that's some performance improvement we will be interested in ourselves. The problem is that when an index doesn't exist, we will get an error So we will need to check if the index exists and only force it then. We would cache this eg in tracker cache general to not needing to query the DB all the time. We could specifically check if the index with name Cheers @tpimpao fyi @mattab |
Great! At this time i'm very happy with the performance. Cheers @tsteur TP |
Hi there,
I have struggled with a problem that occurs at the peak of the day's highest load, causing a high CPU load on the database server.
My database server:
I have about 20 million page views per month, so, my dedicated database server are complaint with Matomo requirements.
I'm using MariaDB 10.4.10 and this is my.cnf file
In the highest peak of the day i see that MySQL get allot slows querys similar to below:
I don't have any problems running this query's directly, but i have a lot of them in the state "Sending Data" when i run the SHOW FULL PROCESSLIST;
Hi attach the "innodb status" file.
What i'm missing?
innodb-status.txt
Thanks!
TP
The text was updated successfully, but these errors were encountered: