Cassandra: how to initialize the counter column with value? -
i have benchmark cassandra facebook linkbench. there 2 phase during benchmark, load , request phase. in load phase, linkbench fill cassandra tables : nodes, links , counts (for links counting) default values(graph data).
the count table looks this:
keyspace.counttable ( link_id bigint, link_type bigint, time bigint, version bigint, count counter, primary key (link_id, link_type, time, version)
my question how insert default counter values (before incrementing , decrementing counter in linkbench request phase) ?
if isn't possible cassandra, how should increment/decrement bigint variable (instead of counter variable)
any suggest , comments? lot.
the default value zero. given
create table counttable ( link_id bigint, link_type bigint, time bigint, version bigint, count counter, primary key (link_id, link_type, time, version) );
and
update counttable set count = count + 1 link_id = 1 , link_type = 1 , time = 1 , version = 1;
we see value of count 1.
select * counttable ; link_id | link_type | time | version | count ---------+-----------+------+---------+------- 1 | 1 | 1 | 1 | 1 (1 rows)
so, if want set other value can:
update counttable set count = count + 500 link_id = 1 , link_type = 1 , time = 1 , version = 2; select * counttable ; link_id | link_type | time | version | count ---------+-----------+------+---------+------- 1 | 1 | 1 | 1 | 1 1 | 1 | 1 | 2 | 500 (2 rows)
Comments
Post a Comment