Skip to content
Advertisement

How to clear a table in hbase?

I want to empty a table in hbase… eg: user. Is there any command or function to empty the table without deleting it…

My table structure is :

JavaScript

Can someone help me?

Advertisement

Answer

There’s no single command to clear Hbase table, but you can use 2 workarounds: disable, delete, create table, or scan all records and delete each.

Actually, disable, delete and create table again takes about 4 seconds.

JavaScript

If there’s not a lot of data in table – scan all rows and delete each is much faster.

JavaScript

In this case data is not deleted physically, actually it’s “marked as deleted” and stays in table until next major compact.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement