Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't join more than two series, and even those return empty results #624

Closed
kinghajj opened this issue Jun 5, 2014 · 5 comments
Closed

Comments

@kinghajj
Copy link

kinghajj commented Jun 5, 2014

The documentation states rather definitively "Joins will put two or more series together." So, I wrote a tiny node.js script to write the results of os.cpus() once a second. At first I put each CPU's data into a separate series, and then tried to join them to make a continuous query with their aggregate data

select cpu0.idle + cpu1.idle + cpu2.idle + cpu3.idle from cpu0 inner join cpu1 inner join cpu2 inner join cpu3

To my dismay, however, this query did not parse! Looking at the code made it clear why: the grammar currently only allows a two series to be joined.

Looking at the examples, I decided to restructure the database so that there is one table, "cpus", with an additional column "cpu" for the cpu ID. I then tried to do a simple join like this

select cpu0.idle + cpu1.idle from cpus as cpu0 inner join cpus as cpu1 where cpu0.cpu = 0 and cpu1.cpu = 1

...and got back an empty list! My script explicitly sets the time column for each point, so for each unique time there is an row for every CPU id. Any idea on why this join is failing to produce any useful results?

Here's the current script:

var influx = require('influx');
var os = require('os');

var client = influx({
    host: 'influxdb-test',
    port: 8086,
    username: 'dbuser',
    password: 'password',
    database: 'example'
});

setInterval(function () {
    var now = new Date().getTime();
    var cpuInfos = os.cpus();
    for (var i in cpuInfos) {
        var point = cpuInfos[i].times;
        point.time = now;
        point.cpu = parseInt(i);
        client.writePoint('cpus', point, function (err) {
            if (err) throw err;
        });
    }
}, 1000);
@Pavel---L
Copy link

It's said in docs that we can join multiple series. In practice I can join only two series. When I try to join more than two series I'm always get syntax error. Could you please give a valid syntax for multi series joins?

@toddboom toddboom added the idea label Nov 25, 2014
@kawikao
Copy link

kawikao commented Apr 5, 2015

+1. Not a deal killer but it would save a lot of collector hacking to combine on the client side. Thanks

@jemc
Copy link

jemc commented Apr 11, 2015

This is currently keeping me from being able to calculate an application's Apdex score and display it in Grafana, because the Apdex formula uses three variables (see http://apdex.org/overview.html) and I get a syntax error when trying to join three series.

@jemc
Copy link

jemc commented May 16, 2015

@beckettsean - For completeness' sake, can you explain how this is obsoleted by v0.9.0?

@beckettsean
Copy link
Contributor

JOIN is no longer a concept in 0.9. Series sharing a measurement can be queried together simply by omitting the differentiating tags from the WHERE clause.

If you have challenges with 0.9 and merging three series as mentioned in your earlier comment, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants