title: Issue with performance of SQL with 'group by' (MySQL)
body: <p>I have a MySQL table as below (i'm using MySQl 5.6):</p>
  
  <pre><code>CREATE TABLE `sm_query_1` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `keyword` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
    `search_type_id` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
    `device_code` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
    `country_code` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
    `search_date` date DEFAULT NULL,
    `clicks` int(11) DEFAULT NULL,
    `impressions` int(11) DEFAULT NULL,
    `position` float DEFAULT NULL,
    `page_uri` text COLLATE utf8_unicode_ci,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
  </code></pre>
  
  <p>And I need run below SQL:</p>
  
  <pre><code>SELECT
                  *, SUM(clicks)total_click,
                  SUM(impressions)total_impression,
                  SUM(clicks)* 100 / SUM(impressions)ctr,
                  AVG(position)position_avg
  FROM
                  `sm_query_1`
  WHERE
                  (
                   `search_date` &gt;= '2015-10-01'
                  AND `search_date` &lt;= '2015-12-30'
                  )
  GROUP BY
                  `keyword`
  ORDER BY
                  `total_click` DESC
  </code></pre>
  
  <p>When table 'sm_query_1' has 6 million records (in period: 2015-10-01 ~ 2015-12-30), this SQL need about 3-5 minutes to run.
  I tried to creat indexes for column <code>search_date</code> and <code>keyword</code> but speed not be improved.</p>
  
  <p>How to optimize this table structure and this SQL command?</p>
  
  <p>(i want to this SQL run only &lt;= 30s)</p>