Query 5: Sort the data using a Covering index

Fetch the name and phone number of all passengers.

SELECT bag.contactPhone, bag.fullName FROM BaggageInfo bag
ORDER BY bag.fullName

Plan:

{
  "iterator kind" : "RECEIVE",
  "distribution kind" : "ALL_SHARDS",
  "order by fields at positions" : [ 1 ],
  "input iterator" :
  {
    "iterator kind" : "SELECT",
    "FROM" :
    {
      "iterator kind" : "TABLE",
      "target table" : "BaggageInfo",
      "row variable" : "$$bag",
      "index used" : "compindex_namephone",
      "covering index" : true,
      "index row variable" : "$$bag_idx",
      "index scans" : [
        {
          "equality conditions" : {},
          "range conditions" : {}
        }
      ]
    },
    "FROM variable" : "$$bag_idx",
    "SELECT expressions" : [
      {
        "field name" : "contactPhone",
        "field expression" :
        {
          "iterator kind" : "FIELD_STEP",
          "field name" : "contactPhone",
          "input iterator" :
          {
            "iterator kind" : "VAR_REF",
            "variable" : "$$bag_idx"
          }
        }
      },
      {
        "field name" : "fullName",
        "field expression" :
        {
          "iterator kind" : "FIELD_STEP",
          "field name" : "fullName",
          "input iterator" :
          {
            "iterator kind" : "VAR_REF",
            "variable" : "$$bag_idx"
          }
        }
      }
    ]
  }
}

Explanation: