3 ms·
SQL definitely has weaknesses, but I wish people wouldn't use "straw man" examples to crap all over it. The flux example from his blog post would look something
by georgewfraser 8y ago
SQL definitely has weaknesses, but I wish people wouldn't use "straw man" examples to crap all over it. The flux example from his blog post would look something like this:
select
lag(value, 0) over recent * 1 +
lag(value, 1) over recent * 0.5 +
lag(value, 2) over recent * 0.25 +
... as exp_moving_avg
from telegraph
where time > datetime_sub(current_datetime(), interval 1 hour)
and measurement = 'foo'
window recent as (order by time rows 10 preceding)
Here, the main difference between flux is that flux has a built-in exponential moving average function, whereas in SQL we have to actually write out the formula.
- jamra 8y agoAre you referring to windowing functions?
- techno_modus 8y ago> Here, the main difference between flux is that flux has a built-in exponential moving average function, whereas in SQL we have to actually write out the formula. The possibility to provide arbitrary data processing functions is one of the core features of contemporary query languages. In SQL it has always been a huge problem (and your example is a good demonstration). In the example provided by they also rely on a built-in (exponential smoothing) function and therefore it is not clear whether I can really perform arbitrary ad-hoc computations within the query itself (without built-in or externally defined functions).
- Twisell 8y ago> The possibility to provide arbitrary data processing functions is one of the core features of contemporary query languages. Yes and this is actually a big selling point of PostgreSQL based solutions. It's important that peoples don't confuse Modern SQL solutions with the ones they may have encountered decades earlier or comparison with NoSQL will indeed be unfair.