You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@gora.apache.org by Sznajder ForMailingList <bs...@gmail.com> on 2013/12/05 15:52:00 UTC

Adding unique value to the table.

Hi,

I am keeping a table mapping from Long to a persistent object.

However, I would like to add the persistent object iff this object has not
been already added to the table.

I thought about a solution:

-Keeping a second table with Key == my object unique id.
-Before adding the object to my primary table, I check that this unique Id
is not in the secondary table.

However,  this solution is very time consuming : it decreases the time
whole writing operation by 30%

What is, please, the right solution for that ?

Best regards

Benjamin

Re: Adding unique value to the table.

Posted by Alfonso Nishikawa <al...@gmail.com>.
Hi, Benjamin.

The fastest answer is: "there is no solution".

Gora is an abstract layer and still has not been designed that feature
(generalized for all backends).
I read you use HBase.

At this moment, HBase has features that allows that, but, as told, not
leveraged by Gora.
I will comment them here because they are interesting and we would have to
take a look at the rest of backends to see how to generalize it. The
engineering problem relies in if/how to enable extensions and up to how
much compatibility, for each backend.

HBase's client has a method called exists() which involves all the process
of load a row but not sending it through the network.
The other way is using (again HBase's client) the atomic checkAndPut().

Just to capture the information in this message, HBaseTableConnection has
methods for check() and checkAndPut() but are not being used by HBaseStore.
And how about Cassandra, Accumulo, etc?


In general, any ideas?

Regards,

Alfonso Nishikawa


2013/12/5 Sznajder ForMailingList <bs...@gmail.com>

> Hi,
>
> I am keeping a table mapping from Long to a persistent object.
>
> However, I would like to add the persistent object iff this object has not
> been already added to the table.
>
> I thought about a solution:
>
> -Keeping a second table with Key == my object unique id.
> -Before adding the object to my primary table, I check that this unique Id
> is not in the secondary table.
>
> However,  this solution is very time consuming : it decreases the time
> whole writing operation by 30%
>
> What is, please, the right solution for that ?
>
> Best regards
>
> Benjamin
>

Re: Adding unique value to the table.

Posted by Sznajder ForMailingList <bs...@gmail.com>.
PS: I am using HBASE with GORA.


On Thu, Dec 5, 2013 at 4:52 PM, Sznajder ForMailingList <
bs4mailinglist@gmail.com> wrote:

> Hi,
>
> I am keeping a table mapping from Long to a persistent object.
>
> However, I would like to add the persistent object iff this object has not
> been already added to the table.
>
> I thought about a solution:
>
> -Keeping a second table with Key == my object unique id.
> -Before adding the object to my primary table, I check that this unique Id
> is not in the secondary table.
>
> However,  this solution is very time consuming : it decreases the time
> whole writing operation by 30%
>
> What is, please, the right solution for that ?
>
> Best regards
>
> Benjamin
>