How to delete a few rows via SQL in QuestDB?

Viewed 1263

is there a way to delete a view rows matching a query in QuestDB? I can't find any statement allowing me that.

This would be the best option:

delete from mytable where columnvalue==2;

Thanks!

1 Answers

In QuestDb Update and Delete statement are not supported. At least now. The ways to delete data are:

  1. Drop a partition

  2. Write a copy of the table without the rows you want to delete, drop table and then rename the table to the one you wanted. Something like

    Create table mytablecopy AS (
    SELECT * FROM mytable where columnvalue != 2
    ) Timstamp(...) PARTITION BY ...;
    
    DROP TABLE mytable;
    RENAME table mytablecopy TO mytable;
    

These are costly workarounds for exceptional cases.

Related