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

Allow use of column indexes for count queries

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • 100

      Currently, count queries do not use SBE. This prevents any count-like query from using the column index, such asĀ 

      db.order_lineitem.aggregate(
      [
          {
              $match: {
                  $and: [
                      { "order.o_orderdate": { $gte: ISODate("1992-01-01") } },
                      { "order.o_orderdate": { $lte: ISODate("1996-01-01") } },
                      { l_discount: { $gte: 0.1 } },
                      { l_discount: { $lte: 0.3 } }
                  ],
                  l_quantity: {
                      $lte: 25
                  }
              },
          },
          {
              $group: {
                      _id: 1,
                      count: {
                          $sum: 1
                      }
                  }
              }
          ]
      ) 

      This ticket is to allow queries to use SBE for counts when an eligible column index is available. Doing this in a somewhat clean way will be tricky, because we have to choose the engine based on what indexes are available.

            Assignee:
            alyssa.clark@mongodb.com Alyssa Clark
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: