BlogsShopifyPagination with Relative Cursors

Pagination with Relative Cursors

Pagination with Relative Cursors

2
posts
2019–2021

This feature thread tracks the development and implementation of relative cursor pagination across Shopify's APIs. Initially, the platform relied on offset-based pagination, which led to significant performance degradation for large datasets. This post details the introduction of relative cursor pagination as a solution, enabling faster and more scalable data retrieval by remembering the last record's ID or sortable field value. The initiative involves standardizing pagination patterns, providing faster and more scalable data retrieval. This post also explores strategies for optimizing GraphQL queries on the client-side, including techniques for handling large and slow queries, preparing for paginated lists, rolling out new features, and making queries faster. It details strategies like designing base queries, loading multiple product pages, controlling new field rollouts using `@include` and `@skip` tags, chaining queries, and using parallel queries to improve performance and scalability.

2021

Querying Strategies for GraphQL Clients - Shopify

6/15/2021

This post details strategies for optimizing GraphQL queries on the client-side, including techniques for handling large and slow queries, preparing for paginated lists, rolling out new features, and making queries faster. It details strategies like designing base queries, loading multiple product pages, controlling new field rollouts using `@include` and `@skip` tags, chaining queries, and using parallel queries to improve performance and scalability.

2019

Pagination with Relative Cursors - Shopify

8/12/2019

This post introduces and advocates for the adoption of relative cursor pagination as a replacement for offset-based pagination in Shopify's APIs. It details the performance issues associated with large offsets, demonstrating with empirical data how query times increase exponentially. The post explains the mechanics of relative cursor pagination, including handling unique and non-unique sortable fields, and provides examples of how to implement it. It also discusses the challenges of rolling out this change across a large organization, the proposed solution involving standardized patterns and common code, and the migration strategy. The post highlights the performance benefits observed in early adoptions and sets a timeline for full deprecation of offset-based pagination.