How to get InfluxDB measurement size?

Shubham Bansal picture Shubham Bansal · Sep 20, 2018 · Viewed 7.8k times · Source

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?

Answer

DrPsychick picture DrPsychick · Jun 26, 2019

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.