Thanks to Low. We use CompositeColumn to substitue it in single not-equality and definite equalitys query. And we will give up cassandra because of the weak query ability and unstability. Many times, we found our data in confusion without definite cause in our cluster. For example, only two rows in one CF, row1-columnname1-columnvalue1,row2-columnname2-columnvalue2, but some times, it becomes row1-columnname1-columnvalue2,row2-columnname2-columnvalue1. Notice the wrong column value. ------------------ Original ------------------ From: "Richard Low"<r...@acunu.com>; Date: Tue, Dec 11, 2012 07:44 PM To: "user"<user@cassandra.apache.org>;
Subject: Re: Why Secondary indexes is so slowly by my test? Hi, Secondary index lookups are more complicated than normal queries so will be slower. Items have to first be queried in the index, then retrieved from their actual location. Also, inserting into indexed CFs will be slower (but will get substantially faster in 1.2 due to CASSANDRA-2897). If you need to retrieve large amounts of data with your query, you would be better off changing your data model to not use secondary indexes. Richard. On 7 December 2012 03:08, Chengying Fang <cyf...@ngnsoft.com> wrote: Hi guys, I found Secondary indexes too slowly in my product(amazon large instance) with cassandra, then I did test again as describe here. But the result is the same as product. What's wrong with cassandra or me? Now my test: newly installed ubuntu-12.04 LTS , apache-cassandra-1.1.6, default configure, just one keyspace(test) and one CF(TestIndex): CREATE COLUMN FAMILY TestIndex WITH comparator = UTF8Type AND key_validation_class=UTF8Type AND default_validation_class = UTF8Type AND column_metadata = [ {column_name: tk, validation_class: UTF8Type, index_type: KEYS} {column_name: from, validation_class: UTF8Type} {column_name: to, validation_class: UTF8Type} {column_name: tm, validation_class: UTF8Type} ]; and 'tk' just three value:'A'(1000row),'B'(1000row),'X'(increment by test) The test query from cql: 1,without index:select count(*) from TestIndex limit 1000000; 2,with index:select count(*) from TestIndex where tk='X' limit 1000000; When I insert 60000 row 'X', the time:1s and 12s. When 'X' up to 130000,the time:2.3s and 33s. When 'X' up to 250000,the time:3.8s and 53s. According to this, when 'X' up to billon, what's the result? Can Secondary indexes be used in product? I hope it's my mistake in doing this test.Can anyone give some tips about it? Thanks in advance. fancy -- Richard Low Acunu | http://www.acunu.com | @acunu