cql

Cassandra: Create a partitioned table without including the partitioned column name in primary key

China☆狼群 提交于 2020-02-06 07:55:47
问题 I want to create a partitioned table without including the partitioned column name in primary key. I am not getting any clue how to create it because most of the examples declaring the clustering column in the primary key section. I am not sure whether it is doable in Cassandra or not hence seeking some help. CREATE TABLE crossfit_gyms_by_city ( country_code text, state_province text, city text, gym_name text, year int, month int, day int); My requirement is : The table should be able to

Cassandra - CQL OR Operator

巧了我就是萌 提交于 2020-02-05 08:27:08
问题 I am trying to learn cassandra. I am using windows community edition (2.0) . My table schema is: CREATE TABLE test.TestTable2 ( PK1 int, PK2 int, CK3 int, CK4 int, Dump text, PRIMARY KEY ((PK1,PK2,CK3),CK4) ); I want to query the dump value for (PK1=1 and Pk2 =2 and Ck3 =5 and CK4 in (4,5)) or (PK1=2 and Pk2 =2 and Ck3 =5 and CK4 in (4,5)) . I am unable to use or condition , can someone suggest how can I do that in CQL 回答1: There is no support for OR operator: what you'd like to do is hit 2

How to get tombstone count for a cql query?

◇◆丶佛笑我妖孽 提交于 2020-01-24 02:29:13
问题 I am trying to evaluate number of tombstones getting created in one of tables in our application. For that I am trying to use nodetool cfstats. Here is how I am doing it: create table demo.test(a int, b int, c int, primary key (a)); insert into demo.test(a, b, c) values(1,2,3); Now I am making the same insert as above. So I expect 3 tombstones to be created. But on running cfstats for this columnfamily, I still see that there are no tombstones created. nodetool cfstats demo.test Average live

Cassandra tombstones count multiple queries vs single query

て烟熏妆下的殇ゞ 提交于 2020-01-23 13:18:07
问题 I've a cassandra table definition as following CREATE TABLE mytable ( colA text, colB text, timeCol timestamp, colC text, PRIMARY KEY ((colA, colB, timeCol), colC) ) WITH.... I want to know if number of tombstones would vary between following types of queries: 1. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111 Above query affect multiple records, (multiple values of colC) 2. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111 AND colC = '...'

cassandra pagination: the difference between driver and CQL

女生的网名这么多〃 提交于 2020-01-15 11:44:06
问题 I am reading driver pagination in here. but CQL also support LIMIT in WHERE clause. Wonder what is the difference between these two 回答1: Pagination is how much you of your result you work with at a time. WHERE and LIMIT are about what is in your result. Imagine you request all rows where X < 100. This may refer to 1 million different rows. If the client or the server requested all of this at once it would cause a lot of resource pressure. To avoid this the driver is capable of asking for just

Unable to use cassandra counter column with cassandra gem

时间秒杀一切 提交于 2020-01-15 10:10:50
问题 I have created a column family by following command using cqlsh: create table mystats (key PRIMARY KEY, count counter); Now from the cqlsh I am able to increase the counter column but when I attempt to do this from cassandra gem, as adviced at: Are there any Ruby clients for Cassandra with counters and supercolumn? So when I use: @stats.add(:mystats, 'randomkey', 1, 'count') I get an error: Cassandra::AccessError at /client Invalid column family "mystats" When I further looked into it, I

Joining two result sets into one

空扰寡人 提交于 2020-01-14 14:05:59
问题 I wanted to know if there's a way to join two or more result sets into one. I actually need to execute more than one query and return just one result set. I can't use the UNION or the JOIN operators because I'm working with Cassandra (CQL) Thanks in advance ! 回答1: Framework like Playorm provide support for JOIN (INNER and LEFT JOINs)queries in Cassandra. http://buffalosw.com/wiki/Command-Line-Tool/ You may see more examples at: https://github.com/deanhiller/playorm/blob/master/src/test/java

Upgrade cassandra cql spec

試著忘記壹切 提交于 2020-01-14 05:26:12
问题 Is there any way to upgrade cassandra cql spec version from 3.1.1 to 3.1.4 without upgrading cassandra itself? We are using cassandra version 2.0.9 and haven't found any documentation related to this issue. 来源: https://stackoverflow.com/questions/26386341/upgrade-cassandra-cql-spec

How to use cql queries to get different datatypes out of cassandra with java client hector

时光毁灭记忆、已成空白 提交于 2020-01-12 07:11:27
问题 I'm new to cassandra and hector so i'm trying to execute cql queries but the problem is that not all columns are of type string so how dow I execute the query "select * from users"? My column family looks like this: UPDATE COLUMN FAMILY users WITH comparator = UTF8Type AND key_validation_class=UTF8Type AND column_metadata = [ {column_name: full_name, validation_class: UTF8Type} {column_name: email, validation_class: UTF8Type} {column_name: state, validation_class: UTF8Type, index_type: KEYS}

Is there a clear equivalent of 'show keyspaces' in cqlsh 2?

自作多情 提交于 2020-01-10 06:52:33
问题 What cqlsh command can I use to quickly see the keyspaces in a cluster? cqlsh does not provide show keyspaces and describe cluster isn't as concise as I want. I'm working using the following specifications: cqlsh 2.2.0, Cassandra 1.1.10, CQL spec 2.0.0, Thrift protocol 19.33.0 回答1: Very simple. Just enter this command in your cqlsh shell and enjoy select * from system.schema_keyspaces; In C*3.x, we can simply use describe keyspaces 回答2: Just try this: describe keyspaces However you may need