<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>DataStax Support Forums &#187; Topic: Range Query with reverse = true</title>
		<link>http://www.datastax.com/support-forums/topic/range-query-with-reverse-true</link>
		<description>Software, Support, and Training for Apache Cassandra</description>
		<language>en-US</language>
		<pubDate>Mon, 20 May 2013 01:58:47 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.3</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.datastax.com/support-forums/search.php</link>
		</textInput>
		<atom:link href="http://www.datastax.com/support-forums/rss/topic/range-query-with-reverse-true" rel="self" type="application/rss+xml" />

		<item>
			<title>Anonymous on "Range Query with reverse = true"</title>
			<link>http://www.datastax.com/support-forums/topic/range-query-with-reverse-true#post-1041</link>
			<pubDate>Tue, 10 Jan 2012 20:34:33 +0000</pubDate>
			<dc:creator>Anonymous</dc:creator>
			<guid isPermaLink="false">1041@http://www.datastax.com/support-forums/</guid>
			<description>&#60;p&#62;I have 2 different flavors of CF with the same data&#60;/p&#62;
&#60;p&#62;create column family story_top_ten_covisited&#60;br /&#62;
  with column_type = 'Standard'&#60;br /&#62;
  and comparator = 'CompositeType(org.apache.cassandra.db.marshal.ReversedType(org.apache.cassandra.db.marshal.LongType),org.apache.cassandra.db.marshal.UTF8Type)'&#60;br /&#62;
  and default_validation_class = 'UTF8Type'&#60;/p&#62;
&#60;p&#62;create column family story_top_ten_covisited_increasing&#60;br /&#62;
  with column_type = 'Standard'&#60;br /&#62;
  and comparator = 'CompositeType(org.apache.cassandra.db.marshal.LongType,org.apache.cassandra.db.marshal.UTF8Type)'&#60;br /&#62;
  and default_validation_class = 'UTF8Type'&#60;br /&#62;
  and key_validation_class = 'UTF8Type'&#60;/p&#62;
&#60;p&#62;Both are similar in all respects , apart from the org.apache.cassandra.db.marshal.ReversedType(org.apache.cassandra.db.marshal.LongType) in the first CF.&#60;/p&#62;
&#60;p&#62;I run Hector code &#60;/p&#62;
&#60;p&#62;MultigetSliceQuery&#38;lt;String,Composite,String&#38;gt; multigetSliceQuery =&#60;br /&#62;
			HFactory.createMultigetSliceQuery(keyspace, StringSerializer.get(), cs,StringSerializer.get());&#60;br /&#62;
		multigetSliceQuery.setColumnFamily(CF_TT);&#60;br /&#62;
		multigetSliceQuery.setKeys(getKeysFromStories(recentStories));&#60;br /&#62;
		multigetSliceQuery.setRange(null, null , true , 10);&#60;br /&#62;
		QueryResult&#38;lt;Rows&#38;lt;String, Composite,String&#38;gt;&#38;gt; q = multigetSliceQuery.execute();&#60;/p&#62;
&#60;p&#62;with reverse true or false.&#60;/p&#62;
&#60;p&#62;I see that when reverse = true is outperforming reverse=false ( in both cases ) by a factor of 30 .... &#60;/p&#62;
&#60;p&#62;I am using version 1.0.5.   I would have assumed and ( &#60;a href=&#34;http://thelastpickle.com/2011/10/03/Reverse-Comparators/&#34; rel=&#34;nofollow&#34;&#62;http://thelastpickle.com/2011/10/03/Reverse-Comparators/&#60;/a&#62; ) supports the natural intuition , that if I want my composite keys to be in  descending , based on the first key, I would be better off using &#34;reversed = true&#34; in my CF creation script and than use &#34;false&#34; in my Hector range query.&#60;/p&#62;
&#60;p&#62;The tests show that assumption is incorrect.  &#60;/p&#62;
&#60;p&#62;Is there a gap in my understanding here ?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
