what's the api for get_data?

Or rather, what exactly consists of the 'dp' parameter. I figured out it means 'data points' so it's some form of resolution, but where is its range determined? I've been looking around a bit and wanted to play with it I think it could be optimized a bit with some SQL voodoo. I think the resolution would however then be limited to micro, mili, seconds, minutes, days etc. but that sounds like a perfect resolution ;)

Anyway, this all is from around here:

https://github.com/emoncms/emoncms/blob/master/Modules/feed/engine/Mysql...

where I have an additional question. At line 71 (marked above) there appears to be different select strategies for certain ranges, like when the range is above 50 hours, a complelty different query runs then when the time is 1.3min - 50 hours and even different when the range is below that. Why is that?

oliver's picture

Re: what's the api for get_data?

Nobody at all?

I'm just curious as to how the resolution is decided on, is it micro/milli seconds or some arbitrarily chosen(calculated) value?

TrystanLea's picture

Re: what's the api for get_data?

Good to hear your interest in the exact workings, The different query range types where selected because each query type is the fastest query in its time range. Selecting all datapoints is faster when the range and number of datapoints is small enough, selecting an average using mysql becomes faster for a period and then the php for loop is faster over the larger ranges.

The move to timestore and phptimeseries provides query speeds that are much better than mysql, interested to hear though if you think you can improve the mysql query speed.

oliver's picture

Re: what's the api for get_data?

Well I was interested as I was porting emoncms to both postgres and SQLite. See my pullrequest over on github, 106.

I did dabble with improving performance with 'got_data', my test function, but I really need a bigger data set and a fully tested and working setup to see and compare all this.

 

Though discussing all this would really need its own thread or over on github ;)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.