Note that there are some explanatory texts on larger screens.

plurals
  1. POCompound Indexes in Apache Cassandra
    text
    copied!<p>I am trying to set up a cassandra column family with secondary indexes on a few columns I will need to filter by when reading data back out. In my initial testing, when I use multiple indexes together, things slow down. Here is how I have it configured currently (via cassandra-cli):</p> <pre><code>update column family bulkdata with comparator=UTF8Type and column_metadata=[{column_name: test_field, validation_class: UTF8Type}, {column_name: create_date, validation_class: LongType, index_type: KEYS}, {column_name: domain, validation_class: UTF8Type, index_type: KEYS}]; </code></pre> <p>I want to get all data where create_date > somevalue1 and column_name = somevalue2. Using pycassa for my client I do the following:</p> <pre><code> domain_expr = create_index_expression('domain', 'whatever.com') cd_expr = create_index_expression('create_date', 1293650000, GT) clause = create_index_clause([domain_expr, cd_expr], count=10000) for key, item in col_fam.get_indexed_slices(clause): ... </code></pre> <p>This is a common mistake in SQL of course, where one would normally have to create a compound index, based on the query needs. I'm quite new to cassandra though, so I don't know if such a thing is required or even exists.</p> <p>My interactions with cassandra will include large numbers of writes, and large numbers of reads and updates. I have set up the indexes figuring they were the right thing to do here, but perhaps I am completely wrong. I'd be interested in any ideas for setting up a performant system, with my index setup or without.</p> <p>oh, and this is on cassandra 0.7.0-rc3</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload