This query shows up over and over in the mysql slow query log (dominant thing I see):
( SELECT idvisitor,
visit_last_action_time,
visit_first_action_time,
idvisit,
visit_exit_idaction_url,
visit_exit_idaction_name,
visitor_returning,
visitor_days_since_first,
visitor_days_since_order,
location_country,
location_continent,
referer_name,
referer_keyword,
referer_type,
visitor_count_visits,
visit_goal_buyer
,
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
,
0 as priority
FROM piwik_log_visit
WHERE visit_last_action_time >= '2012-03-11 14:30:40' AND idsite = '1' AND config_id = 'b91»Ç~B°¡'
ORDER BY visit_last_action_time DESC
LIMIT 1
)
UNION
( SELECT idvisitor,
visit_last_action_time,
visit_first_action_time,
idvisit,
visit_exit_idaction_url,
visit_exit_idaction_name,
visitor_returning,
visitor_days_since_first,
visitor_days_since_order,
location_country,
location_continent,
referer_name,
referer_keyword,
referer_type,
visitor_count_visits,
visit_goal_buyer
,
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
,
1 as priority
FROM piwik_log_visit
WHERE visit_last_action_time >= '2012-03-11 14:30:40' AND idsite = '1' AND idvisitor = 'W~Sn~\P~T^EÅ'
LIMIT 1
)
ORDER BY priority DESC
LIMIT 1;
I get about 230 thousand page views a day so we are fairly active; maybe this is unique to large deployments? Any help?