title: Count data in mysql is very slow
body: <p>I have a mysql query for count data. If the data is 1000 the count process runs normally. But if the data amount to 500000 process count errorr.</p>
  <p>How to speed up the count process in query mysql if the data is big?</p>
  <p>This my query :</p>
  <pre><code>
   $countResults = $db-&gt;SELECT()
                  -&gt;FROM( array(  'MM'=&gt;'M_MEMBER'),
                          array(  'MEMBER_ID'      =&gt; 'MM.MEMBER_ID',
                               )
                        )
                  -&gt;WHERE('DATE(MM.UPLOAD_DATE) = CURDATE()')
                  -&gt;WHERE('SYNC_FLAG = ?','N')
                  -&gt;QUERY()-&gt;FETCHALL();
  
  $totalCountResult =  count($countResults); 
  </code></pre>