Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Left join in influx DB

I am new to influx DB. Now I need to migrate MySQL db into influxDB. I chose influx DB because it support SQL like queries. But I could not found left join in it. I have a series called statistics which contains browser_id and another series contains browser list. How can I join these 2 tables like relational database concept? I wrote this query but it is not giving any result.

select * from statistics as s inner join browsers as b where s.browser_type_id  = b.id

statistics

enter image description here

browsers

enter image description here

like image 932
Sajith Avatar asked Oct 15 '14 07:10

Sajith


People also ask

Does InfluxDB support joins?

Flux allows you to join on any columns common between two data streams and opens the door for operations such as cross-measurement joins and math across measurements. To illustrate a join operation, use data captured by Telegraf and stored in InfluxDB - memory usage and processes.

What is a series in InfluxDB?

In InfluxDB, a series is a collection of points that share a measurement, tag set, and field key.

Does InfluxDB have tables?

Table behavior. The table visualization renders queried data in structured, easy-to-read tables. Columns and rows match those in the query output. If query results contain multiple tables, only one table is shown at a time.

Is InfluxDB relational?

InfluxDB is not relational DB = no primary/foreign keys, no joins of measurements, etc. In theory you can use tags as a work around, but they are designated for data with low cardinality = if you have many records with unique ID tag, then you will need a lot of memory.


2 Answers

Seems that now is possible. Check again documentation: https://docs.influxdata.com/influxdb/v0.8/api/query_language/#joining-series

select hosta.value + hostb.value
from cpu_load as hosta
inner join cpu_load as hostb
where hosta.host = 'hosta.influxdb.orb' and hostb.host = 'hostb.influxdb.org';
like image 56
GBrian Avatar answered Oct 13 '22 21:10

GBrian


You cannot join series in InfluxDB using arbitrary columns. InfluxDB only supports joining time series based on the time column. This is a special type of join unlike the one you're used to in relational databases. Time join in InfluxDB tries to correlate points from different time series that happened at approximately the same time. You can read more about joins in InfluxDB in the docs

like image 44
jvshahid Avatar answered Oct 13 '22 22:10

jvshahid