You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Thibaut_ <tb...@blue.lu> on 2008/12/30 14:32:58 UTC

Exist function?

On a few occasions, I have to check if a key exists in a table or not.

What's the best way to do it? The htable interface doesn't have any function
to check if a key exists or not, and I have to specify at least one column
when fetching a key.

At the moment I have secondary tables (with bloomfilters and blockcache
enabled) just used to check if a key exists. When adding deleting a key, I
will also add/delete an entry in the secondary table

Another possibility would be to just have an nearempty columnfamily used to
test if a key exists (my other column families always have about 100 KB of
data in it, and I don't want hbase to fetch that data from disk).

Thibaut


-- 
View this message in context: http://www.nabble.com/Exist-function--tp21217215p21217215.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: Exist function?

Posted by Andrew Purtell <ap...@yahoo.com>.
Hello Thibaut,

I use get() on a column expected to exist if the row exists
for the given key and expected to contain only a small 
amount of data.

See https://issues.apache.org/jira/browse/HBASE-1102

    - Andy


> From: Thibaut_ <tb...@blue.lu>
> Subject: Exist function?
> To: hbase-user@hadoop.apache.org
> Date: Tuesday, December 30, 2008, 5:32 AM
>
> On a few occasions, I have to check if a key exists in a
> table or not.
> 
> What's the best way to do it? The htable interface
> doesn't have any function to check if a key exists or
> not, and I have to specify at least one column when
> fetching a key.