Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-20895

Use index order to prune sort size

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • Morpheus
    • 4.5.0
    • query

    Description

      As Sitaram Vemulapalli proposed, if the index provides a partial sort, we can use the index order to prune the sort size.

      CREATE INDEX ON docs(a);
       
      SELECT *
      FROM docs
      ORDER BY a, b
      LIMIT 100;
      

      The index does not fully sort the result. But after 100 records and a subsequent change in the value of a, we can abort the index scan and eliminate the remaining records.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ajay.bhullar Ajay Bhullar
            gerald Gerald Sangudi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty