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

RegEx query predicates using the | (vertical bar) character cannot use tight index bounds

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: 2.8.0-rc1
    • Fix Version/s: Backlog
    • Component/s: Querying
    • Labels:
      None

      Description

      The mongodb regex parser cannot create accurate bounds to allow indexed lookups when the regex includes the "|" character. This was allowed previously, but could lead to incorrect results.

      Original Description
      I've got a database with 14 mio rows representing an imaginary "file system". There are (amongst others) the fields "type" (only "folder" or "file"), "folder" and "filename".

      I now try this:

      {
      type:'folder',
      folder:/^example1/
      }
       
      Very fast. No results - as expected. In fact, no rows even start with "example".
       
      I now try this:
       
      {
      type:'folder',
      folder:/^example2/
      }
      

      Very fast, too. No results again - as expected.

      Now, I try this:

       
      {
      type:'folder',
      folder:/^example(1|2)/
      }
      

      This query never returns. The whole database becomes horribly slow to the point of being unusable. I cannot even run any other queries. This used to work on 2.4.x. Why?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-optimization Backlog - Query Optimization
              Reporter:
              rgpublic rgpublic
              Participants:
              Votes:
              5 Vote for this issue
              Watchers:
              16 Start watching this issue

                Dates

                Created:
                Updated: