Ammad
Ammad

Reputation: 4235

InfluxDB design issue

I am using influxDB and using line protocol to insert large set of data into Data base. Data i am getting is in the form of Key value pair, where key is long string contains Hierarchical data and value is simple integer value.

Sample Key Value data :

/path/units/unit/subunits/subunit[name\='NAME1']/memory/chip/application/filter/allocations
value = 500

/path/units/unit/subunits/subunit[name\='NAME2']/memory/chip/application/filter/allocations
value = 100
(Note Name = 2)

/path/units/unit/subunits/subunit[name\='NAME1']/memory/chip/application/filter/free
value = 700
(Note Instead of allocation it is free at the leaf)

/path/units/unit/subunits/subunit[name\='NAME2']/memory/graphics/application/filter/swap
value = 600
Note Instead of chip, graphics is in path)

/path/units/unit/subunits/subunit[name\='NAME2']/harddisk/data/size
value = 400
Note Different path but till subunit it is same

/path/units/unit/subunits/subunit[name\='NAME2']/harddisk/data/free
value=100
Note Same path but last element is different

Below is the line protocol i am using to insert data.

interface, Key= /path/units/unit/subunits/subunit[name\='NAME2']/harddisk/data/free, valueData= 500

I am Using one measurement namely, Interface. And one tag and one field set. But this DB design is causing issue for querying data.

How can I design database so that i can query like, Get all record for subunit where name = Name1 or get all size data for every hard disk.

Thanks in advance.

Upvotes: 0

Views: 167

Answers (1)

Michael Desa
Michael Desa

Reputation: 4747

The Schema I'd recommend would be the following:

interface,filename=/path/units/unit/subunits/subunit[name\='NAME2']/harddisk/data/free value=500

Where filename is a tag and value is the field.

Given that the cardinality of filename in the thousands this schema should work well.

Upvotes: 2

Related Questions