Uploaded image for project: 'Chalmers'
  1. Chalmers
  2. CHAL-243

Understand how/when CQL queries can be used to determine the number of records matching specified criteria

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: TBD
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:

      Description

      Background

      We have assumed that CQL queries, in conjunction with the limit=0 parameter and the returned "totalRecords" value, can be used to determine the number of records in matching the critera specified in the CQL query.

      Being able to use CQL like this to quickly generate simple reports (e.g. how many items did we really create last year?) is tempting for institutions without direct access to their database or - for whatever reason, for example that it's not done - not using LDP.

      We are also relying on CQL queries for this handsome dashboard which displays daily statistics for our tenant: http://folio-libris-rtac.azurewebsites.net/statistics/

      Problem

      While working on CHAL-240, we discovered discrepancies in the numbers returned by SQL queries and seemingly corresponding CQL queries. It was suggested that this might have been due to the issue, described in MODINVSTOR-321, where

      totalRecords is useless unless a query matches < limit record because that's the only circumstance when it only returns a non-estimate value

      The estimate values, as far as I can tell, can be pretty off the mark. So I would like to better understand in which cases this issue occurs, what determines the accuracy of the estimate, and - ultimately - in which cases CQL queries and "allRecords" can provide us with valuable information about the number records matching specific criteria.

      Solution

      https://github.com/folio-org/raml-module-builder#estimated-totalrecords
      is the documation about the totalRecords field, an estimation based on the estimation returned by the PostgreSQL query planner.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              lisams Lisa Sjögren (EBSCO)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: