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

Don't list old metric names? #83

Open
mzealey opened this issue Jul 3, 2020 · 8 comments
Open

Don't list old metric names? #83

mzealey opened this issue Jul 3, 2020 · 8 comments

Comments

@mzealey
Copy link

mzealey commented Jul 3, 2020

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?

@deniszh
Copy link
Member

deniszh commented Jul 3, 2020

@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.

@mzealey
Copy link
Author

mzealey commented Jul 3, 2020

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?

@deniszh
Copy link
Member

deniszh commented Jul 3, 2020

Yep, then SELECT should bit more complex. Reversed is easy, not sure about partial, though.

@Felixoid
Copy link
Collaborator

It looks related to #64

@bzed
Copy link
Contributor

bzed commented Oct 21, 2020

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?

@spoofedpacket
Copy link

Could the 'delete' column features in recent clickhouse versions be leveraged for this?
https://altinity.com/blog/clickhouse-replacingmergetree-explained-the-good-the-bad-and-the-ugly

We are using the ALTER TABLE method described above for some time now, while it works as expected it puts significant load on clickhouse so it would be great to have a lightweight alternative.

@Felixoid
Copy link
Collaborator

Felixoid commented Nov 5, 2024

https://clickhouse.com/docs/en/sql-reference/statements/delete exists for quite a long.

@mzealey
Copy link
Author

mzealey commented Nov 5, 2024

Yeah I'd use the lightweight deletes as above. Probably can just change the 'alter table x delete' bit to 'delete from x'.

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

5 participants