cql3

Does collections in CQL3 have certain limits?

送分小仙女□ 提交于 2019-11-29 06:06:58
As there are two ways to support wide rows in CQL3..One is to use composite keys and another is to use collections like Map, List and Set. The composite keys method can have millions of columns (transposed to rows).. This is solving some of our use cases. However, if we use collections, I want to know if there is a limit that the collections can store a certain number/amount of data (Like earlier with Thrift C* supports up-to 2 billion columns in a row) Apart from the performance issue, there is a protocol issue which limits the number of items you can access to 65536. http://mail-archives

Prepared Statement with collection in IN clause in Datastax Cassandra CQL driver

落爺英雄遲暮 提交于 2019-11-29 01:39:32
I am trying to run the following query SELECT edge_id, b_id FROM booking_by_edge WHERE edge_id IN ? I bind Java list of Long's as a parameter and I get an exception SyntaxError: line 0:-1 mismatched input '<EOF>' expecting ')' (ResultSetFuture.java:242) If I try to use (?) it expects single Long item to be bound, but I need a collection Is there an error in my syntax? Tested in Cassandra 2.1.3, the following code snippet works: PreparedStatement prepared = session.prepare("SELECT edge_id, b_id FROM booking_by_edge WHERE edge_id IN ?;"); List<Long> edgeIds = Arrays.asList(1L, 2L, 3L); session

Difference between UPDATE and INSERT in Cassandra?

走远了吗. 提交于 2019-11-29 01:26:35
问题 What is the difference between UPDATE and INSERT when executing CQL against Cassandra? It looks like there used to be no difference, but now the documentation says that INSERT does not support counters while UPDATE does. Is there a "preferred" method to use? Or are there cases where one should be used over the other? Thanks so much! 回答1: Counter Columns in Cassandra couldn't be set to an arbitrary value: they can only be incremented or decremented by any arbitrary value. For this reason,

Difference between Thrift and CQL 3 Columns/Rows

故事扮演 提交于 2019-11-29 00:38:57
At the Cassandra Summit, it was mentioned that Thrift and CQL 3 have subtle differences in their definitions of columns and rows. The Google hasn't helped me understand this difference. The only information I can find is that the metadata is different, and as such, I shouldn't mix thrift and CQL. What is the subtle difference (I've read a bit about metadata representations...)? in what way does it break the compatibility? Why is the change better? I'm happy to read any docs that will help me, I've just been unable to find anything specifically related to this topic. Here's the reading path I

Cassandra: How to insert a new wide row with good performance using CQL

亡梦爱人 提交于 2019-11-28 20:55:33
I am evaluating cassandra. I am using the datastax driver and CQL. I would like to store some data with the following internal structure, where the names are different for each update. +-------+-------+-------+-------+-------+-------+ | | name1 | name2 | name3 | ... | nameN | | time +-------+-------+-------+-------+-------+ | | val1 | val2 | val3 | ... | valN | +-------+-------+-------+-------|-------+-------+ So time should be the column key, and name should be the row key. The CQL statement I use to create this table is: CREATE TABLE IF NOT EXISTS test.wide ( time varchar, name varchar,

Cassandra: Generate a unique ID?

隐身守侯 提交于 2019-11-28 18:41:42
I'm working on a distributed data base. I'm trying to generate a unique ID that will serve as a column family primary key in cassandra . I read some articles about doing this with Java using UUID but it seems like there is a probability for collision (even if it's very low). I wonder if there is a way to generate a unique ID based on time maybe? Richard You can use the TimeUUID type in Cassandra, which backs a Type 1 UUID . This uses the current time and the creator's MAC address and a sequence number. If the TimeUUID number is generated correctly this can be done with zero collisions (you can

How to copy data from a Cassandra table to another structure for better performance

柔情痞子 提交于 2019-11-28 12:03:22
In several places it's advised to design our Cassandra tables according to the queries we are going to perform on them. In this article by DataScale they state this: The truth is that having many similar tables with similar data is a good thing in Cassandra. Limit the primary key to exactly what you’ll be searching with. If you plan on searching the data with a similar, but different criteria, then make it a separate table. There is no drawback for having the same data stored differently. Duplication of data is your friend in Cassandra. [...] If you need to store the same piece of data in 14

Apache Cassandra delete from counter

五迷三道 提交于 2019-11-28 07:06:40
问题 I'm developing a little web application for studying Apache Cassandra and Java EE 6. Cassandra version is 1.1.6. Have a problem driving me mad... I created a table with a counter (using cqlsh v. 3.0.0) CREATE TABLE test ( author varchar PRIMARY KEY, tot counter ) and put some values this way: update test set tot = tot +1 where author = 'myAuthor'; the column family is perfectly updated author | tot ----------+----- myAuthor | 1 BUT, if you try to delete this row and then update again (with

Results pagination in Cassandra (CQL)

耗尽温柔 提交于 2019-11-28 05:18:59
I am wondering how can I achieve pagination using Cassandra. Let us say that I have a blog. The blog lists max 10 posts per page. To access next posts a user must click on pagination menu to access page 2 (posts 11-20), page 3 (posts 21-30), etc. Using SQL under MySQL, I could do the following: SELECT * FROM posts LIMIT 20,10; The first parameter of LIMIT is offset from the beginning of result set and second argument is amount of rows to fetch. The example above returns 10 rows starting from row 20. How can I achieve the same effect in CQL? I have found some solutions on Google, but all of

Cassandra UUID vs TimeUUID benefits and disadvantages

不想你离开。 提交于 2019-11-28 04:39:21
Given that TimeUUID handily allows you to use now() in CQL, are there any reasons you wouldn't just go ahead and always use TimeUUID instead of plain old UUID? UUID and TIMEUUID are stored the same way in Cassandra, and they only really represent two different sorting implementations. TIMEUUID columns are sorted by their time components first, and then by their raw bytes, whereas UUID columns are sorted by their version first, then if both are version 1 by their time component, and finally by their raw bytes. Curiosly the time component sorting implementations are duplicated between UUIDType