#20639·matomo

Tons of FORCE INDEX (index_idsite_idvisitor) MySQL queries killing Matomo

Author: L3on1dCreated Apr 27, 2023Updated Oct 1, 2026
Labelsc: Performance

Hi!

We have pretty high volume traffic sites, ~ 2 weeks ago we upgraded our DB server from MariaDB 10.5 to 10.6, last week Matomo was upgraded to v4.14.2, after that we start facing new issue.

System info:

OS: Ubuntu 18.04.6 LTS Matomo: 4.14.2 PHP: 8.0.28 DB: 10.6.12-MariaDB

Symptoms:

Once per day our MySQL server becomes unavailable due to tons of queries:

"SELECT visit_last_action_time, visit_first_action_time, idvisitor, idvisit, user_id, visit_exit_idaction_url, visit_exit_idaction_name, visitor_returning, visitor_seconds_since_first, visitor_seconds_since_order, visitor_count_visits, visit_goal_buyer, location_country, location_region, location_city, location_latitude, location_longitude, referer_name, referer_keyword, referer_type, idsite, profilable, visit_entry_idaction_url, visit_total_actions, visit_total_interactions, visit_total_searches, referer_url, config_browser_name, config_client_type, config_device_brand, config_device_model, config_device_type, visit_total_events, visit_total_time, location_ip, location_browser_lang, last_idlink_va, custom_dimension_1, custom_dimension_2, custom_dimension_3, custom_dimension_4, custom_dimension_5, custom_var_k1, custom_var_v1, custom_var_k2, custom_var_v2, custom_var_k3, custom_var_v3, custom_var_k4, custom_var_v4, custom_var_k5, custom_var_v5 FROM mtm_log_visit FORCE INDEX (index_idsite_idvisitor) WHERE idsite = '1' AND visit_last_action_time <= '2023-04-27 00:48:29' AND idvisitor = 'E6???$?'\n ORDER BY visit_last_action_time DESC\n LIMIT 1"

Btw, I found this old topic possible related to our problem - https://github.com/matomo-org/matomo/issues/16904 We have tried this config option - "To workaround this performance issue set [Tracker]enable_userid_overwrites_visitorid=0 in your config/config.ini.php" with no luck. :(

Any help would be appreciated, thank you!