IFQL: INFLUX FUNCTIONAL QUERY LANGUAGE – BRINGING DATA SCIENCE AND ANALYTICS INTO THE DATABASE
Introduction of the new query language that we’re building into InfluxDB and the InfluxData platform. Its design is functional and heavily inspired by projects like Pandas in Python and the Tidyverse projects in R. In addition to providing more complex query functionality, the language will facilitate more analytics and data science workloads within the database. Clustering on time series matrices, similarity metrics and k-nearest neighbors, forecasting models, and other data science tasks may become simple query operators within the query language. This talk will introduce the data model, some of the functions and walk through a working prototype implementation that showcases functionality unavailable in the language.
4. // get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
IFQL
5. // get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
SELECT max(usage_system)
FROM "foo".."cpu"
WHERE "service" = 'app-server'
AND time > now() - 12h
GROUP BY time(10m)
IFQL
InfluxQL (1.x)
6. // get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
IFQL
Functions
7. // get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
IFQL
Function chaining, like jQuery or D3
8. // get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
IFQL
Named arguments
9. // get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
IFQL
Expression language for predicates
10. // get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
IFQL
Comments
11. // get the min, max, mean cpu utilization for all
// application servers
var s = select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
s.max() s.min() s.mean()
IFQL
Variables
37. JavaScript, it u?
// get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
39. // get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
IFQL
Named arguments
40. // get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
IFQL
Expression language for predicates
42. // get the cpu max utilization for all
// application servers
select(db:"foo")
.where(exp:{"_measurement"=="cpu" AND
"_field"=="usage_system" AND
"service"=="app-server"})
.range(start:-12h)
.window(every:10m)
.max()
IFQL
Introduction of new arguments
in future versions won’t break
previous users
43. Make it easy to add functions
like plugins in Telegraf