Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get InfluxDB measurement size?

I have a an InfluxDB measurement named kpi. I want to get the size of that single measurement in MB.

So far I have tried:

du -sh /var/lib/influxdb/data/demo/
27M     /var/lib/influxdb/data/demo/

But this command gives me the size of the whole database.

I have also tried this command:

> select count(counter) from kpi

name: kpi
time count
---- -----
0    1479533
>

But this only gives me the entries count.

How can I get the size of this particular measurement?

like image 292
Shubham Bansal Avatar asked Sep 20 '18 14:09

Shubham Bansal


People also ask

How do I check the size of my InfluxDB?

You can get the the total size of the dbase InfluxDb usage statistics - Store - InfluxData Community from the _internal database.

Does InfluxDB compress data?

Each InfluxDB client library provides options for compressing write requests or enforces compression by default. The method for enabling compression is different for each library.

Why is InfluxDB so slow?

The reason behind this is while you are upgrading, the meta and data are migrated but not the indices. So "InfluxDB must build a new time series index (TSI). Depending on the volume of data present, this may take some time." according to the guide.

How much data can InfluxDB handle?

There are no systemic limits to the amount of data an individual instance can hold. Also the storage engine is very efficient (3 bytes per float or integer value). Data is naturally sharded by time so old data is not touched on most queries. There are InfluxDB users with TBs of data in a single instance.


1 Answers

I have a grafana board that shows me 'filestore' bytes from influx internal stats, like so:

SELECT sum("diskBytes") FROM "_internal".."tsm1_filestore" WHERE time >= now() - 6h GROUP BY time(30s), "database"

This is not the actual size on disk (compared with /var/lib/influxdb/data/), but could give you an indication which database is growing large.

Update:

This ensures to have the latest value of each database which is much more accurate.

SELECT SUM(diskBytes) FROM (
  SELECT max(diskBytes) AS "diskBytes" 
  FROM "influxdb_tsm1_filestore" 
  WHERE $timeFilter AND "database" != 'annotation'
  GROUP BY "database", "id"
)  GROUP BY time($__interval), "database"
like image 87
DrPsychick Avatar answered Oct 05 '22 00:10

DrPsychick