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

Support a compound index on a single metadata field followed by the time field in a time-series collection

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.9.0
    • None
    • Storage
    • None
    • Fully Compatible
    • Execution Team 2021-03-08

    Description

      If the index requested is a compound index with both the metadata and the time fields:

       {
          createIndexes: 'abc',

          indexes: [{ 'mm.tag1': 1, time: 1 }]

      }
      

      The index specification created on the bucket collection will be:

       
      {
          createIndexes: 'system.buckets.abc',

          indexes: [{'meta.tag1': 1, 'control.min.time': 1, 'control.max.time': 1}]
      }
      

      Since buckets in the underlying bucket collection may contain overlapping time ranges, we include both lower and upper bounds in the index to support the query optimizer's ability to order measurements.

      Conversely if the time field has to be indexed in descending order, we would transform a compound index:

      {
          createIndexes: 'abc',
          indexes: [{ 'mm.tag1': 1, time: -1 }]
      
}
      

      as follows:

      {
          createIndexes: 'system.buckets.abc',

          indexes: [{'meta.tag1': 1, 'control.max.time': -1, 'control.min.time': -1}]

      }
      

      Attachments

        Activity

          People

            benety.goh@mongodb.com Benety Goh
            benety.goh@mongodb.com Benety Goh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: