I accidentally inserted data for field key “791” and wish to delete it from the measurement.
> SHOW SERIES (just for L3)
name: L3
fieldKey fieldType
-------- ---------
791 float
P789 float
P790 float
P791 float
P792 float
P793 float
P795 float
So I copy the measurement and get what I am looking for.
> SELECT /P/ INTO "L3_copy2" FROM "L3" GROUP BY *
name: result
time written
---- -------
0 12752
> SHOW SERIES (just for L3_copy2)
name: L3_copy2
fieldKey fieldType
-------- ---------
P789 float
P790 float
P791 float
P792 float
P793 float
P795 float
> SELECT * FROM L3_copy2 LIMIT 3
name: L3_copy2
time P789 P790 P791 P792 P793 P795 day month week year
---- ---- ---- ---- ---- ---- ---- --- ----- ---- ----
1539351900000000000 208.2 5 10 41 2018
1539352800000000000 489.8 211.1 489.3 5 10 41 2018
1539353700000000000 491 490.8 5 10 41 2018
>
And drop the old measurement (and confirmed with SHOW MEASUREMENTS and SHOW FIELD KEYS that it is no longer present).
DROP MEASUREMENT “L3”
And write the data back to the original measurement name.
> SELECT * INTO "L3" FROM "L3_copy2" GROUP BY *
name: result
time written
---- -------
0 12752
But now…
> SHOW SERIES (just for L3)
name: L3
fieldKey fieldType
-------- ---------
791 float
P789 float
P790 float
P791 float
P792 float
P793 float
P795 float
day string
month string
week string
year string
> SELECT * FROM L3 LIMIT 3
name: L3
time 791 P789 P790 P791 P792 P793 P795 day day_1 month month_1 week week_1 year year_1
---- --- ---- ---- ---- ---- ---- ---- --- ----- ----- ------- ---- ------ ---- ------
1539351900000000000 208.2 5 10 41 2018
1539352800000000000 489.8 211.1 489.3 5 10 41 2018
1539353700000000000 491 490.8 5 10 41 2018
> SELECT "791" FROM L3 LIMIT 3
>
As seen , FIELD KEY “791” still exists but has no data. Furthermore, the tag keys have been injected as field keys. I also tried SELECT /P/ INTO "L3" FROM "L3_copy2" GROUP BY *
but got the same results. I’ve tried restarting influxd between queries but no change.
To make maters worse, after dropping L3, if I ever write data to L3, the measurement is recreated with the duplicated tag keys as field keys and erroneous “791” field key.
How can a field key be removed? How is a measurement permanently removed and started from scratch?