emoncms/emoncms — pull request #63 by CapnBry (2013-05-03 15:37:04+00:00)
Title: Continuation of #57, Long rawdata visualization load times

Here's updated code that only uses the mysql method for times less than 50 hours (180,000 seconds). I've also changed the 1000-query method to use bound parameters which speeds the load when using a local mysql database by about 15-20% (220ms to 180ms). I'd be curious to see if that reduces your load times as well on the > 50 hour case.

As an illustration about my other point where the 1000 query select may not be representative of the data it is sampling, here's the graph of my refrigerator power usage for both methods.

![Quantization Error](http://i.imgur.com/1Z2zyu9.png)

Finally, I'm wondering if switching to the MAX() aggregate function in the sql would show better performance than AVG() due to the lack of arithmetic.