Key value with no series


I’m trying to find out why below query results a list where few of the items are key values with no related series in my influxdb2 database.

Can anyone help me with this? I would like to drop that key value item out from the results: I’m using this query in Grafana for filtering purposes.

show tag values from "weather" with key = "device";

Thanks in advance!

@halacs What version of InfluxDB are you using?

$ influx version
Influx CLI dev (git: a79a2a1b825867421d320428538f76a4c90aa34c) build_date: 2024-04-16T14:34:32Z

$ influxd version
InfluxDB v2.7.6 (git: 3c58c06206) build_date: 2024-04-12T21:51:21Z

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy

I believe show tag values has a default time range that it will query for tag values. This particular query is pretty resource intensive because it has to query all data within the time range to identify what tag values exist. You could try including a WHERE clause with a custom time range, but just know that this may affect the overall performance of InfluxDB.

show tag values from "weather" with key = "device" where time > now() - 365d

Hi @scott ,

Do you know, in the below example, why SzombathelyHatsoGarazs is there if there is no series with device=SzombathelyHatsoGarazs at the second query in the selected database?

show tag values from "weather" with key = "device";
┃      1┃device  ┃SzombathelyHatsoGarazs  ┃
┃      2┃device  ┃dolgozo                 ┃
┃      3┃device  ┃elso1                   ┃
┃      4┃device  ┃foldszint1              ┃  
show series
┃     29┃weather,device=dolgozo,id=BC:DD:C2:25:FB:02,sensor=BME280,topic=ostoros_tele_tasmota_25FB02_SENSOR,type=wemos               ┃
┃     30┃weather,device=dolgozo,id=BC:DD:C2:25:FB:02,topic=wemos_BC:DD:C2:25:FB:02_tele                                              ┃
┃     31┃weather,device=elso1,id=2C:F4:32:78:59:1F,sensor=BME280,topic=ostoros_tele_tasmota_78591F_SENSOR,type=wemos                 ┃
┃     32┃weather,device=elso1,id=2C:F4:32:78:59:1F,topic=wemos_2C:F4:32:78:59:1F_tele                                                ┃
┃     33┃weather,device=foldszint1,id=2C:F4:32:78:71:7F,topic=wemos_2C:F4:32:78:71:7F_tele                                           ┃
┃     34┃weather,device=foldszint1,sensor=BME280,topic=ostoros_tele_tasmota_DFE42A_SENSOR,type=wemos                                 ┃
┃     35┃weather,device=foldszint1,sensor=BMP280,topic=ostoros_tele_tasmota_DFE42A_SENSOR,type=wemos                   

I’m wondering if all the points with the SzombathelyHatsoGarazs tag value aged out and your indexes haven’t updated yet. You could try manually rebuilding your indexes and see if it makes a difference.

That helped, thanks a lot!

Do you know why indexes weren’t updated or how frequently should they be updated? Data was deleted months ago. I guess this is somehow a bug and manual index rebuild is a workaround for that. Am I right?

I don’t know a ton about how the retention services (the service that removes expired data) interacts with indexes, but I’ve seen cases similar to this in the past. That’s all I really know.

I see. Thanks a lot @scott !