incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clint Kelly <clint.ke...@gmail.com>
Subject Re: Combine multiple SELECT statements into one RPC?
Date Fri, 28 Feb 2014 17:56:37 GMT
Hi Sylvain,

Thanks for your response.  I am writing code to allow users to query a
table that looks something like this:

CREATE TABLE time_series_stuff (
  key text,
  family text,
  qualifier text,
  version long,
  val blob,
  PRIMARY KEY (key, family, qualifier, version)
) WITH CLUSTERING ORDER BY (family ASC, qualifier ASC, version DESC)

To a user, working with this table looks something like working with a
nested map (from family -> qualifier -> version -> value).

A user of our system can create a single data request that indicates that
he or she would like to fetch data for a given (family, qualifier, version)
value, but a user can also do things like:

   - Specify only a (family, qualifier) -> fetch all of the versions
   - Specify (family, qualifier, min and max versions) -> fetch all of the
   versions in a range
   - Specify (family) -> fetch all qualifiers, all versions in a family
   - Specify (family, *, min and max versions) -> fetch all values with
   version range for any qualifier

etc.

So some of the data requests from users can translate into multiple C*
SELECT statements.  I was just looking for a way to combine them into a
single client / server transaction, if possible.  At the moment I'm just
issuing multiple SELECT statements, which is fine, but I was wondering if
there was a way to combine them together somehow.

Thanks for your help!

Best regards,
Clint






On Thu, Feb 27, 2014 at 1:05 AM, Sylvain Lebresne <sylvain@datastax.com>wrote:

> On Thu, Feb 27, 2014 at 1:00 AM, Clint Kelly <clint.kelly@gmail.com>wrote:
>
>> Hi all,
>>
>> Is there any way to use the DataStax Java driver to combine multiple
>> SELECT statements into a single RPC?  I assume not (I could not find
>> anything about this in the documentation), but I just wanted to check.
>>
>
> The short answer is no.
>
> The slightly longer answer is that the DataStax Java driver uses the
> so-called native protocol. And that protocol does not allow to have
> multiple SELECT into a single protocol message (the protocol is not really
> RPC-based strictly speaking so I'll assume you meant one client->server
> message here), and it follows that the driver can't either. But I'll note
> that the reason why the protocol doesn't have such a thing is that it's
> generally a better idea to parallelize your SELECT client side, though
> since you haven't provided much context for you question I'd rather not go
> into too much details here since that might be off-topic.
>
> --
> Sylvain
>

Mime
View raw message