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

Support 2ndary index queries with only inequality clauses (LT, LTE, GT, GTE)

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Fix Version/s: None
    • Component/s: CQL
    • Labels:

      Description

      Currently, a query that uses 2ndary indexes must have at least one EQ clause (on an indexed column). Given that indexed CFs are local (and use LocalPartitioner that order the row by the type of the indexed column), we should extend 2ndary indexes to allow querying indexed columns even when no EQ clause is provided.

      As far as I can tell, the main problem to solve for this is to update KeysSearcher.highestSelectivityPredicate(). I.e. how do we estimate the selectivity of non-EQ clauses? I note however that if we can do that estimate reasonably accurately, this might provide better performance even for index queries that both EQ and non-EQ clauses, because some non-EQ clauses may have a much better selectivity than EQ ones (say you index both the user country and birth date, for SELECT * FROM users WHERE country = 'US' AND birthdate > 'Jan 2009' AND birtdate < 'July 2009', you'd better use the birthdate index first).

        Attachments

        1. cassandra-trunk-4476.patch
          16 kB
          Oded Peer
        2. 4476-5.patch
          30 kB
          Oded Peer
        3. 4476-3.patch
          20 kB
          Oded Peer
        4. 4476-2.patch
          21 kB
          Oded Peer

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                slebresne Sylvain Lebresne
              • Votes:
                7 Vote for this issue
                Watchers:
                28 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: