title: Mysql query performing very slow
body: <p>I have one table with approx 20M records, and I am going to simple compute on some of the fields of that table. But it is taking to much time to fetch data. I am considering all records that's why no index comes in a picture. 
  Let me explain :</p>
  
  <pre><code>Table : UserLoginDet
          ------------ 
  LoginID    INT
  UserID     INT
  Date       DATETIME
  SpentTime  INT
  </code></pre>
  
  <p>Now I want total for my dashboard like this.</p>
  
  <pre><code>SELECT COUNT(1) NoOfLogins, DISTINCT(UserID) NoOfUsers, SUM(SpentTime) UsedTime;
  </code></pre>
  
  <p>This query taking 5-6 seconds to execute. Is it ok or not. I think it is very slow for just 20M records. What should I have to do?</p>
  
  <p>EDITED : 
  My explain report :</p>
  
  <pre><code>id Select_type  table        type  possible_key  key      key_len  ref   rows    Extra
  -- -----------  -----        ----  ------------  -------  -------  ---   ------  ------ 
  1  PRIMARY  UserLoginDet     range PRIMARY      PRIMARY  3              797143  Using where
  </code></pre>
  
  <p>Thanks </p>