Performance optimizations#

Due to large number of objects in the database, some queries for paginated results might be very slow or timeout entirely. To mitigate this, we provide an option to exclude the total calculation on large collections for a significant speedup.

Affected endpoints:

  • /v1/images

  • /v1/repositories/registry/{registry}/repository/{repository}/tag/{tag}

  • /v1/images/nvr/{nvr}

  • /v1/images/id/{identifier}/vulnerabilities

  • /v1/tag-history

  • /v1/tag-history/id/{identifier}/images

Affected queries:

  • find_images

  • find_repository_images_by_registry_path

  • find_images_by_nvr

  • find_image_vulnerabilities

  • find_tag_histories

  • find_tag_history_images

To exclude total in REST, use exclude query parameter:

https://catalog.redhat.com/api/containers/v1/images?exclude=total

To exclude total in GraphQL, simply do not include it in the list of requested fields:

{
  find_images {
    error {
      status
      detail
    }
    # total (commented out)
    data {
      _id
    }
  }
}