10

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

Sajith
  • 2,842
  • 9
  • 37
  • 49

2 Answers2

10

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

FraggaMuffin
  • 3,915
  • 3
  • 22
  • 26
jvshahid
  • 356
  • 2
  • 2
  • I checked the document. But there is no much documentation about it. Can you explain with sample data? Example like two series with sample data. – Sajith Oct 16 '14 at 11:06
  • In actual versions this joining (or merging) is automatic if you omit tag. But keep in mind that it's only possible within it the same measurement (https://docs.influxdata.com/influxdb/v1.6/query_language/data_exploration/#merge-behavior) – lujop Jul 15 '18 at 20:19
4

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';
GBrian
  • 1,031
  • 11
  • 28
  • 3
    I think this is exactly the _join_ type that @sajith was talking about. Definitely not a traditional _relational join_. – Jorge Diaz May 27 '16 at 13:32
  • 3
    Does somebody know where descriptions of joins are gone from influxdb docs for version 1.6 ? – Bunyk Jul 16 '18 at 16:04