Skip to content

Should self hosted cluster support deletes? #6174

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

Open
NickyHeuperman opened this issue May 24, 2025 · 4 comments
Open

Should self hosted cluster support deletes? #6174

NickyHeuperman opened this issue May 24, 2025 · 4 comments
Labels
C-bug Category Bugs

Comments

@NickyHeuperman
Copy link

What type of bug is this?

Incorrect result

What subsystems are affected?

Query Engine

Minimal reproduce step

I'm trying to delete data from a table, I'm howver met with the following error:
Unsupported region request: Delete
Is there something I need to enable? Or are deletes simply not supported self hosted?

What did you expect to see?

Rows being deleted

What did you see instead?

Unsupported region request: Delete

What operating system did you use?

Docker

What version of GreptimeDB did you use?

0.14.3

Relevant log output and stack trace

@NickyHeuperman NickyHeuperman added the C-bug Category Bugs label May 24, 2025
@killme2008
Copy link
Contributor

@NickyHeuperman Hi. The delete operation is supported https://docs.greptime.com/reference/sql/delete/

Are you trying to delete data from the metrics tables written by Prometheus remote write? Sorry, currently logical tables cannot be deleted—you need to delete from the physical tables instead, specifically from greptime_physical_table.

@killme2008
Copy link
Contributor

killme2008 commented May 24, 2025

To delete the prometheus_build_info metric table from greptime_physical_table, use this SQL statement:

delete from greptime_physical_table where __table_id in
  (select table_id from information_schema.tables where table_name='prometheus_build_info');

This query retrieves the table_id from information_schema.tables by table name and then deletes the corresponding data from greptime_physical_table using that __table_id (the logical table ID).

@NickyHeuperman
Copy link
Author

Can I filter by time range here then? And/or tags?

@killme2008
Copy link
Contributor

Of course you can.
For example, if you query the table_id from tables:

mysql> select table_id from information_schema.tables where table_name='prometheus_build_info';
+----------+
| table_id |
+----------+
|     1374 |
+----------+
1 row in set (0.03 sec)

Which is 1374, then you can delete data with timestamp or other columns:

delete from greptime_physical_table where greptime_timestamp > '2025-05-25 00:00:00' and  __table_id =1374;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category Bugs
Projects
None yet
Development

No branches or pull requests

2 participants