Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-17144

Use text search suffix field predicates to limit index scan

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Querying, Text Search
    • None
    • Query
    • Fully Compatible

    Description

      To set the terminology:

      In the following index description

      {a: 1, b: 1, c: "text", d: 1, e: 1}

      the text index prefix is {a: 1, b: 1} and the text index suffix is {d: 1, e: 1}.

      Predicates over the fields in the text index suffix are not used to constrain the number of documents index-scanned during a full-text search.

      For example consider a collection where the search predicate

      {a: 123, b: 456, $text: {$search: 'foo bar'}} 

      would find 30 documents, and

      {a: 123, b: 456, $text: {$search: 'foo bar'}, d: {$gte: 0}} 

      would find only 10 documents.

      During the second query the query optimizer does not use the 'd' predicate to avoid scanning the other 20 documents during the query execution. The "nscanned" value will be 30 for both, even though "n" is different.

      Attachments

        Activity

          People

            backlog-server-query Backlog - Query Team (Inactive)
            akira.kurogane Akira Kurogane
            Votes:
            2 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: