Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-6644

CQL: Select every nth row within the same partition key

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Normal
    • Resolution: Duplicate
    • None
    • None
    • None

    Description

      In a time-series schema (like metrics), it is common to create roollups/buckets with datapoints at different rate.
      It would be nice to have a keyword in CQL to be able to retrieve one every nth row (within a single storage engine wide row).

      For example, in the following schema:

      CREATE TABLE metrics (
      ... metric_id varchar,
      ... ts timestamp,
      ... value float,
      ... PRIMARY KEY (metric_id, ts)
      ... );

      The following query, will retrieve 1 in every 3 rows:

      (SKIP keyword or something like that, but don't focus on the syntax)
      SELECT ts, value WHERE metric_id = ? SKIP 2;

      This would be very useful for continuous (and somehow linear) metrics.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jorgebg Jorge Bay
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: