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

SASI: Index intersection with an empty range really inefficient

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Fix Version/s: 3.11.0, 4.0
    • Component/s: Feature/SASI
    • Labels:
      None

      Description

      It looks like RangeIntersectionIterator.java and be pretty inefficient in some cases. Let's take the following query:

      SELECT data FROM table WHERE index1 = 'foo' AND index2 = 'bar';

      In this case:

      • index1 = 'foo' will match 2 items
      • index2 = 'bar' will match ~300k items

      On my setup, the query will take ~1 sec, most of the time being spent in disk.TokenTree.getTokenAt().

      if I patch RangeIntersectionIterator so that it doesn't try to do the intersection (and effectively only use 'index1') the query will run in a few tenth of milliseconds.

      I see multiple solutions for that:

      • Add a static thresold to avoid the use of the index for the intersection when we know it will be slow. Probably when the range size factor is very small and the range size is big.
      • CASSANDRA-10765

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                iksaif Corentin Chary
                Reporter:
                iksaif Corentin Chary
                Authors:
                Corentin Chary
                Reviewers:
                Alex Petrov
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: