You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Sam Ganesan <sa...@motorola.com> on 2011/05/10 15:33:32 UTC
Newbie question
All:
A newbie question to the aficianados. I understand that I can stipulate an
ordering mechanism when I create a column family to reflect what I am
querying in the long run. Generally I need to query a particular column
space that I am contructing based on two different columns. The frequency
of these queries is not that different from each other. I query based on a
numberical ID or a name with equal frequency.
What is the recommended way of approaching this problem
Regards
Sam
*__
Sam Ganesan Ph.D.
Distinguished member, Technical Staff
Motorola Mobility - On Demand Video
900 Chelmsford Street,
Lowell, MA 01851
tel:+1 978 614-3165 (changed)
mob:+1 978 328-7132
mailto: sam.ganesan@motorola.com*
Re: Newbie question
Posted by aaron morton <aa...@thelastpickle.com>.
Depending on the data size and workload consider storing the data under both keys, in the same CF. e.g. keys "id/1234" and "name/MrFoo" are different rows with the same data in them.
Or us secondary indexes or a custom index using another CF as Narenda suggests. Secondary indexes are doing pretty much the same thing, just server side and a bit faster.
Hope that helps.
-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com
On 11 May 2011, at 04:14, Narendra Sharma wrote:
> You can have only one ordering defined in a CF. Super CF will allow you to have nested ordering i.e. SC can have one ordering whereas columns within SC can have other ordering. Note this is defined at CF level and cannot be defined at SC level.
>
> To model what you are trying to do, you can check if secondary indexes will be useful (assuming you have standard CF). If not you can create another CF that will just keep NAME as column name and ID as column value. This will ensure ordering by NAME and pointer to original column (or SC depending on your schema). The downside is you will need to run 2 queries to get the data.
>
> -Naren
>
> On Tue, May 10, 2011 at 6:33 AM, Sam Ganesan <sa...@motorola.com> wrote:
> All:
>
> A newbie question to the aficianados. I understand that I can stipulate an ordering mechanism when I create a column family to reflect what I am querying in the long run. Generally I need to query a particular column space that I am contructing based on two different columns. The frequency of these queries is not that different from each other. I query based on a numberical ID or a name with equal frequency.
>
> What is the recommended way of approaching this problem
>
> Regards
>
> Sam
> __
> Sam Ganesan Ph.D.
> Distinguished member, Technical Staff
> Motorola Mobility - On Demand Video
> 900 Chelmsford Street,
> Lowell, MA 01851
> tel:+1 978 614-3165 (changed)
> mob:+1 978 328-7132
> mailto: sam.ganesan@motorola.com
>
>
>
> --
> Narendra Sharma
> Solution Architect
> http://www.persistentsys.com
> http://narendrasharma.blogspot.com/
>
>
Re: Newbie question
Posted by Nate McCall <na...@datastax.com>.
If I understand correctly, CompositeType comparator
(https://issues.apache.org/jira/browse/CASSANDRA-2231) may be of
interest to you once it becomes available.
Re: Newbie question
Posted by Narendra Sharma <na...@gmail.com>.
You can have only one ordering defined in a CF. Super CF will allow you to
have nested ordering i.e. SC can have one ordering whereas columns within SC
can have other ordering. Note this is defined at CF level and cannot be
defined at SC level.
To model what you are trying to do, you can check if secondary indexes will
be useful (assuming you have standard CF). If not you can create another CF
that will just keep NAME as column name and ID as column value. This will
ensure ordering by NAME and pointer to original column (or SC depending on
your schema). The downside is you will need to run 2 queries to get the
data.
-Naren
On Tue, May 10, 2011 at 6:33 AM, Sam Ganesan <sa...@motorola.com>wrote:
> All:
>
> A newbie question to the aficianados. I understand that I can stipulate an
> ordering mechanism when I create a column family to reflect what I am
> querying in the long run. Generally I need to query a particular column
> space that I am contructing based on two different columns. The frequency
> of these queries is not that different from each other. I query based on a
> numberical ID or a name with equal frequency.
>
> What is the recommended way of approaching this problem
>
> Regards
>
> Sam
> *__
> Sam Ganesan Ph.D.
> Distinguished member, Technical Staff
> Motorola Mobility - On Demand Video
> 900 Chelmsford Street,
> Lowell, MA 01851
> tel:+1 978 614-3165 (changed)
> mob:+1 978 328-7132
> mailto: sam.ganesan@motorola.com*
>
--
Narendra Sharma
Solution Architect
*http://www.persistentsys.com*
*http://narendrasharma.blogspot.com/*