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

How to DELETE TAG VALUES in Influxdb? #5092

Closed
meng2014 opened this issue Dec 11, 2015 · 14 comments
Closed

How to DELETE TAG VALUES in Influxdb? #5092

meng2014 opened this issue Dec 11, 2015 · 14 comments

Comments

@meng2014
Copy link

I recently use InfluxDB to save my datas.AND when save data to InfluxDb,I set a TAG key of "host" with the value of "myhost" to series,like this:
Point.measurement("supervisor").field("slotsTotal", tmp.getSlotsTotal()).tag("host", tmp.getHost());
AND,I set a RETENTION POLICIES of 7 days to this database. That means datas retain 7 days.After 7 days those will be deleted.
Then,the issue is coming..
After datas deleted , the TAG VALUES of those datas is NOT deleted.There is a phenomenon that all datas with this TAG VALUE are deleted,but this TAG VALUE not deleted.Then I want SHOW current TAG VALUES ,that means I want to show TAG VALUES that contains some datas NOT none datas.AND all VALUES hits.AND I do not find DELETE TAG VALUES function.Please help me..

@beckettsean
Copy link
Contributor

Tag values are part of the definition of a series, and thus part of the index. They are never deleted from the index, nor can they be, without destroying the index itself.

Instead what you need is for this feature to be implemented: #4029

Closing this in favor of #4029

@meng2014
Copy link
Author

I scan #4029.But it still does not help me.What I want is to filter TAG VALUES by anyway like time.I don't want to show TAG VALUES that do not contain any datas. Please!

@beckettsean
Copy link
Contributor

@meng2014 I linked you to that request to show you that SHOW TAG VALUES does not yet respect any WHERE clause, including one with time. Filtering your results by time is the only way it will ever work as you desire.

InfluxDB is not like a relational database with a fixed and centralized schema. There is no one central store that "knows" whether any points have a particular tag value or not. The tag value appears in the series index, meaning at least one point has been written with that tag value, but there is no way and likely never will be a way to determine whether that point is still in the database.

Consistency like that is I/O and computationally intensive. InfluxDB achieves high throughput by avoiding that complexity and resource cost, but it does mean there are some traditional database functions that InfluxDB cannot do.

@meng2014
Copy link
Author

@beckettsean OK,Thanks for your answers.I understand the design intent of InfluxDB.I respect it.But I retain my demand.Because I think maybe it is important for some scenes.Thank you.

@beckettsean
Copy link
Contributor

@meng2014 If all you need is to remove tags from the index, you can achieve what you want with DROP SERIES: https://docs.influxdata.com/influxdb/v0.9/query_language/database_management/#delete-series-with-drop-series. Note that this is not a performant query, and may require large amounts of RAM to succeed.

@mpchadwick
Copy link
Contributor

mpchadwick commented Jul 29, 2016

The ability to strip tags off a measurement could be useful, perhaps a something was added as a tag, but on second though you realize that it is increasing your cardinality too rapidly. Thus, you stop pushing that tag, but you still want to retain the old data. I imagine you could do something with a continuous query or SELECT INTO to remove the tag from the old data, but it would be nice if there was an easy way to do it.

@ZhukovAlexey
Copy link

ZhukovAlexey commented Jul 4, 2018

After datas deleted , the TAG VALUES of those datas is NOT deleted.There is a phenomenon that all datas with this TAG VALUE are deleted,but this TAG VALUE not deleted.

I I do, for example: DROP SERIES WHERE "host" = 'vcrsappn.moscow.alfaintra.net' then I still see this host in SHOW TAG VALUES WITH key = "host" output.
But after InfluxDB restart it seem that in-memory indices rebuild and this host disappear from tags.

@Naumis1
Copy link

Naumis1 commented Jul 11, 2018

Hi, I have same issue, but when I do DROP SERIES WHERE host = some_host I still see tag value some_host even I restart influxdb. Just updated from previous version to 1.6.0 and problem is still here.

@ZhukovAlexey
Copy link

@Naumis1 please provide
1 SHOW TAG VALUES WITH key = "host" WHERE host ='deleted_host'
2 SELECT * FROM your_measurement WHERE host ='deleted_host'

@Naumis1
Copy link

Naumis1 commented Jul 14, 2018

Hi, thanks for replay. Here's output:
`

show tag values with key = "host" where host =~ /^rob-test-virt$/
name: cpu
key value


host rob-test-virt

name: disk
key value


host rob-test-virt

name: diskio
key value


host rob-test-virt

name: interrupts
key value


host rob-test-virt

name: kernel
key value


host rob-test-virt

name: linux_sysctl_fs
key value


host rob-test-virt

name: mem
key value


host rob-test-virt

name: net
key value


host rob-test-virt

name: netstat
key value


host rob-test-virt

name: processes
key value


host rob-test-virt

name: soft_interrupts
key value


host rob-test-virt

name: swap
key value


host rob-test-virt

name: system
key value


host rob-test-virt

SELECT * FROM system WHERE host ='rob-test-virt'
SELECT * FROM swap WHERE host ='rob-test-virt'
SELECT * FROM soft_interrupts WHERE host ='rob-test-virt'
SELECT * FROM processes WHERE host ='rob-test-virt'
SELECT * FROM netstat WHERE host ='rob-test-virt'
SELECT * FROM net WHERE host ='rob-test-virt'
SELECT * FROM mem WHERE host ='rob-test-virt'
SELECT * FROM linux_sysctl_fs WHERE host ='rob-test-virt'
SELECT * FROM kernel WHERE host ='rob-test-virt'
SELECT * FROM interrupts WHERE host ='rob-test-virt'
SELECT * FROM diskio WHERE host ='rob-test-virt'
SELECT * FROM cpu WHERE host ='rob-test-virt'
SELECT * FROM mem WHERE host ='rob-test-virt'
`
All last queries there empty results. So no remaining data.

@moophat
Copy link

moophat commented Jul 17, 2018

I'm having the same issue on 2 different measurements. One is OK after influxdb restart (DROPped tag disappear after influxdb is restarted). On the other measurement (snmp), old junk tag is retain even after all related series has been dropped and influx has also been restart several time.

** show tag values with key in ("metric") **

This measurements is OK, all junk metric (tag) is gone after series is dropped and influxdb is

name: check-snmp-with-oid-text-index
key value


metric Delay
metric Jitter
metric pktLoss

This one is polluted no mater what I do, any query to these tag/metric return nothing so I'm pretty sure all the related series has been gone

name: snmp
key value


metric BusinessQueued_ae29
metric BusinessQueued_ae30
metric BusinessQueued_ae31
metric BusinessRedDropped_ae29
metric BusinessRedDropped_ae30
metric BusinessRedDropped_ae31
metric BusinessTailDropped_ae29
metric BusinessTailDropped_ae30
metric BusinessTailDropped_ae31
metric BusinessTxed_ae29
metric BusinessTxed_ae30
metric BusinessTxed_ae31
metric CPU_RE0
metric CPU_RE1
metric InternetQueued_ae29
.....

So I'm assuming that series somehow stayed in indexes even after the DROP query has been isssued. Is there any good way to track this bug and drop these index other than SELECT INTO?

@akamac
Copy link

akamac commented Aug 9, 2018

I face the same issue. Restart does not help. Anything that I'm doing wrong?

> DROP SERIES WHERE "cluster" = "HVCLUCO-11F-Cluster"
> SHOW TAG VALUES FROM "hv_vswitch" WITH KEY = "cluster"
name: hv_vswitch
key     value
---     -----
cluster HVCLUCO-11F
cluster HVCLUCO-11F-Cluster
cluster HVCLUCO-21F
cluster HVCLUCO-21F-Cluster
cluster HVCLUVA-11F
cluster HVCLUVA-11F-Cluster
cluster HVCLUVA-21F
cluster HVCLUVA-21F-Cluster
cluster HVCLUVA-31B
cluster HVCLUVA-31B-Cluster
cluster HVCLUVA-41B
cluster HVCLUVA-41B-Cluster
cluster IMHVCLUVACS71
cluster IMHVCLUVXCS71

@ushuz
Copy link

ushuz commented Dec 5, 2018

@ZhukovAlexey @Naumis1 @moophat @akamac

I think the issue that tags of dropped series still appear in SHOW TAG VALUES is being tracked here: #10285

@picarro-abdullahz
Copy link

One workaround can be to remove all the data tagged with the relevant tag key, then restart your influx service and influx should remove that tag value.

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

9 participants