Is there any way to delete all data on clickhouse tables with a memory engine?

2.6k views Asked by At

Most of the time, the data that stays in the database causes the tests to fail, so I need to clear the database before running my tests. Do you know a way to clear the clickhouse before running the tests, like DatabaseMigrations in Laravel?

1

There are 1 answers

0
Denny Crane On

Engine=Memory supports truncate table

create table xxxm(a Int64) engine = Memory;
insert into xxxm values (1), (2), (3);

select count() from xxxm;
┌─count()─┐
│       3 │
└─────────┘

truncate table xxxm;

select count() from xxxm
┌─count()─┐
│       0 │
└─────────┘