Tomi Järvinen - 2011-08-11

I have been happily using dtgraph about 3.5 years. The MySQL database has around 14M rows, and over the time the dtgraph + MySQL has started to perform slower. I did all kind of MySQL index and cache tuning, and did get the response times a little better, but not much. Today I found something that did improve the performance a lot. It was in the code which queries the time of first "insert" done in the table:

www/Driver/sql.php:
<         $q = 'SELECT MIN(unix_timestamp(time)) from '.$this->_params['table'];
>         $q = 'SELECT unix_timestamp(MIN(time)) from '.$this->_params['table'];

With default MySQL setup this query took around 7-9 seconds, and with cache/index tweaking 4-6 seconds. Now with the above code change it takes only a fraction of a second.

-Tomi