On Tue, Jul 10, 2012 at 4:17 PM, Leonid Ilyevsky <lilyev...@mooncapital.com> wrote: > So I guess, in the batch_mutate call, in the map that I pass to it, only the > first element of the composite key should be used as a key (because it is the > real key), and the other parts of the key should be passed as regular > columns? Is this correct? While I am waiting for your confirmation, I am > going to try it.
I would really advise you to use the BATCH statement of CQL3 rather than the thrift batch_mutate call. If only because until https://issues.apache.org/jira/browse/CASSANDRA-4377 is resolved it won't work at all, but also because the whole point of CQL3 is to hide that kind of complexity. -- Sylvain > > -----Original Message----- > From: Sylvain Lebresne [mailto:sylv...@datastax.com] > Sent: Tuesday, July 10, 2012 8:24 AM > To: user@cassandra.apache.org > Subject: Re: Dynamic CF > > On Fri, Jul 6, 2012 at 10:49 PM, Leonid Ilyevsky > <lilyev...@mooncapital.com> wrote: >> At this point I am really confused about what direction Cassandra is going. >> CQL 3 has the benefit of composite keys, but no dynamic columns. >> I thought, the whole point of Cassandra was to provide dynamic tables. > > CQL3 absolutely provide "dynamic tables"/wide rows, the syntax is just > different. The typical example for wide rows is a time serie, for > instance keeping all the events for a given event_kind in the same C* > row ordered by time. You declare that in CQL3 using: > CREATE TABLE events ( > event_kind text, > time timestamp, > event_name text, > event_details text, > PRIMARY KEY (event_kind, time) > ) > > The important part in such definition is that one CQL row (i.e a given > event_kind, time, event_name, even_details) does not map to an internal > Cassandra row. More precisely, all events sharing the same event_kind will be > in the same internal row. This is a wide row/dynamic table in the sense of > thrift. > > >> I need to have a huge table to store market quotes, and be able to query it >> by name and timestamp (t1 <= t <= t2), therefore I wanted the composite key. >> Loading data to such table using prepared statements (CQL 3-based) was very >> slow, because it makes a server call for each row. > > You should use a BATCH statement which is the equivalent to batch_mutate. > > -- > Sylvain > > This email, along with any attachments, is confidential and may be legally > privileged or otherwise protected from disclosure. Any unauthorized > dissemination, copying or use of the contents of this email is strictly > prohibited and may be in violation of law. If you are not the intended > recipient, any disclosure, copying, forwarding or distribution of this email > is strictly prohibited and this email and any attachments should be deleted > immediately. This email and any attachments do not constitute an offer to > sell or a solicitation of an offer to purchase any interest in any investment > vehicle sponsored by Moon Capital Management LP ("Moon Capital"). Moon > Capital does not provide legal, accounting or tax advice. Any statement > regarding legal, accounting or tax matters was not intended or written to be > relied upon by any person as advice. Moon Capital does not waive > confidentiality or privilege as a result of this email.