title: How to optimize report queries
body: <p>I studied here and there but i couldn't find a way to optimize this query.</p>
  
  <pre><code>SELECT  ad_request.user_id,
      ads.req_id,
      ads.id as doneId 
  FROM ads
      INNER JOIN ad_request ON ads.req_id = ad_request.req_id 
  WHERE 
      (ads.user_id='3612185701') AND ads.date&gt;DATE_ADD(NOW(),INTERVAL -4 DAY) 
  ORDER BY ads.id
  </code></pre>
  
  <p>Query Digest:</p>
  
  <pre><code># Attribute    pct   total     min     max     avg     95%  stddev  median
  # ============ === ======= ======= ======= ======= ======= ======= =======
  # Count          0     836
  # Exec time     17    322s   481us     11s   385ms      2s   956ms    51ms
  # Lock time      0   203ms   103us    23ms   242us   332us   787us   185us
  # Rows sent     67 209.30k       0   3.56k  256.36   1.46k  478.03    1.96
  # Rows examine   1 1021.57k       0  55.08k   1.22k   4.71k   3.05k  202.40
  # Rows affecte   0       0       0       0       0       0       0       0
  # Query size     0 218.29k     262     268  267.38  258.32       0  258.32
  </code></pre>
  
  <p>the digest is just from a 30-minute frame , sometimes several instances of this query get stuck for +100 sec</p>