Don't list old metric names?
mzealey opened this issue · 8 comments
Is there a way to filter the metric name list so that I can exclude metrics that have not been inserted in the past few days? I can see in the RU wiki page there is detail about the old index_tree table where you could set Deleted = 1
but can't seem to find any documentation about how to do this currently?
@mzealey : if your Clickhouse support deletion you can try same trick, but with DELETE
ALTER TABLE graphite_index DELETE
WHERE (Path LIKE 'PREFIX.%')
GROUP BY Path
HAVING max(Version) < toUInt32(toDateTime(today() - 7))
But I'm not sure if DELETE WHERE supports GROUP BY ... HAVING clause.
I imagine sometihng like this would work:
ALTER TABLE graphite_index
DELETE WHERE Path in (
SELECT Path
FROM graphite_index
WHERE (Path LIKE 'PREFIX.%')
GROUP BY Path
HAVING max(Version) < toUInt32(toDateTime(today() - 7))
)
But there are also partial and reversed paths etc as well; do they not need deleting somehow?
Yep, then SELECT should bit more complex. Reversed is easy, not sure about partial, though.
Also I think you want to select the Paths from graphite_index first, then remove the data from the graphite table and then tidy the graphite_index table? Does that make sense?