Skip to content

Instantly share code, notes, and snippets.

@RoyBellingan
Created February 23, 2014 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RoyBellingan/9170698 to your computer and use it in GitHub Desktop.
Save RoyBellingan/9170698 to your computer and use it in GitHub Desktop.
MySQL [piwik]> explain SELECT
-> log_visit.custom_var_k2 AS `custom_var_k2`,
-> log_visit.custom_var_v2 AS `custom_var_v2`,
-> count(distinct log_visit.idvisitor) AS `1`,
-> count(*) AS `2`,
-> sum(log_visit.visit_total_actions) AS `3`,
-> max(log_visit.visit_total_actions) AS `4`,
-> sum(log_visit.visit_total_time) AS `5`,
-> sum(case log_visit.visit_total_actions when 1 then 1 when 0 then 1 else 0 end) AS `6`,
-> sum(case log_visit.visit_goal_converted when 1 then 1 else 0 end) AS `7`
-> FROM
-> log_visit AS log_visit
-> WHERE
-> log_visit.visit_last_action_time >= '2014-02-12 23:00:00'
-> AND log_visit.visit_last_action_time <= '2014-02-13 22:59:59'
-> AND log_visit.idsite = '14' AND log_visit.custom_var_k2 != ''
-> GROUP BY
-> log_visit.custom_var_k2, log_visit.custom_var_v2;
+----+-------------+-----------+------+---------------------------------------------------------------------------+------------------------------+---------+-------+--------+-----------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+------+---------------------------------------------------------------------------+------------------------------+---------+-------+--------+-----------------------------+
| 1 | SIMPLE | log_visit | ref | index_idsite_config_datetime,index_idsite_datetime,index_idsite_idvisitor | index_idsite_config_datetime | 4 | const | 268930 | Using where; Using filesort |
+----+-------------+-----------+------+---------------------------------------------------------------------------+------------------------------+---------+-------+--------+-----------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment