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

[BP to 7.1.2] - Improve pagination queries with fetch

    XMLWordPrintable

Details

    • 1

    Description

      CREATE INDEX ix1 ON default (c1,c2);
      SELECT * FROM
      default AS d
      WHERE d.c1 != 10 
      ORDER BY d.c2
      LIMIT 100
      OFFSET 10000;
      

      Above query not covered, not using index order so pagination not passed to indexer.
      So end up fetching all qualified documents (instead of LIMIT only documents), then sort and apply pagination.

      Here Indexer has all the information in predicate and order by (projection info is not there)

      Alternative is as follows but very inconvenient.

       
      SELECT d1.* FROM
      default AS d1 USE KEYS (SELECT RAW META(d).id
                              WHERE d.c1 != 10 
                              ORDER BY d.c2
                              LIMIT 100
                              OFFSET 10000);
      

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-52254
          # Subject Branch Project Status CR V

          Activity

            People

              ajay.bhullar Ajay Bhullar
              bingjie.miao Bingjie Miao
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty