When you do a query, there's a lot of comparison happening between what's queries and the column names. But the composite comparator is lazy in that when it compares two names, if the first component are not equal, it doesn't have to compare the second one. So What's likely happening is that in the first case you do 1 millions comparison of 8 bytes, in the latter you do 1 millions comparison of 100 bytes.
-- Sylvain On Fri, Mar 30, 2012 at 2:30 PM, Alexandru Sicoe <adsi...@gmail.com> wrote: > Sender: adsi...@gmail.com > Subject: composite query performance depends on component ordering > Message-Id: > <caadnm_f7xeznnmop-fwgey-f9utjepynxdch3fxhqk6ncag...@mail.gmail.com> > Recipient: adam.nicho...@hl.co.uk > > > ______________________________________________________________________ > This email has been scanned by the Symantec Email Security.cloud service. > For more information please visit http://www.symanteccloud.com > ______________________________________________________________________ > > ---------- Forwarded message ---------- > From: Alexandru Sicoe <adsi...@gmail.com> > To: <user@cassandra.apache.org> > Cc: > Date: Fri, 30 Mar 2012 14:29:47 +0200 > Subject: composite query performance depends on component ordering > Hi guys, > I am consistently seeing a 20% improvement in query retrieval times if I use > the composite comparator "Timestamp:ID" instead of "ID:Timestamp" where > Timestamp=Long and ID=~100 character strings. I am retrieving all columns > (~1 million) from a single row. Why is this happening? > > Cheers, > Alex >