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 :
$mutations = array(
new Mutation( array(
'column' => 'username:1',
'value' =>$name
) ),
new Mutation( array(
'column' => 'email:1',
'value' =>$email
) )
);
$hbase->mutateRow("user",$key,$mutations);
Can someone help me?
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.
If there’s not a lot of data in table – scan all rows and delete each is much faster.
In this case data is not deleted physically, actually it’s “marked as deleted” and stays in table until next major compact.