Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple Query Slow
    text
    copied!<p>Is there anyway to get better performance out of this.</p> <pre><code>SELECT fdyofmth, SUM(total_restored) AS total_restored FROM sum_restored WHERE fdyofmth BETWEEN '2010-11-01' AND '2011-11-01' GROUP BY fdyofmth ORDER BY fdyofmth DESC </code></pre> <p>The result takes 3 secs.</p> <pre><code>+------------+----------------+ | fdyofmth | total_restored | +------------+----------------+ | 2011-11-01 | 39793 | | 2011-10-01 | 52367 | | 2011-09-01 | 52141 | | 2011-08-01 | 56515 | | 2011-07-01 | 54668 | | 2011-06-01 | 54874 | | 2011-05-01 | 60025 | | 2011-04-01 | 60005 | | 2011-03-01 | 63856 | | 2011-02-01 | 64472 | | 2011-01-01 | 58943 | | 2010-12-01 | 57005 | | 2010-11-01 | 55731 | +------------+----------------+ </code></pre> <p>EXPLAIN result -</p> <pre><code>+----+-------------+--------------+------+---------------+------+---------+------+--------+----------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+--------------+------+---------------+------+---------+------+--------+----------------------------------------------+ | 1 | SIMPLE | sum_restored | ALL | NULL | NULL | NULL | NULL | 752660 | Using where; Using temporary; Using filesort | +----+-------------+--------------+------+---------------+------+---------+------+--------+----------------------------------------------+ 1 row in set </code></pre> <p>I have tried putting a KEY of fdyofmth which actually made it twice as slow.</p> <p>Any help would be much appreciated.</p> <p>Thank you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload