What are the performance implications of using offset‑based pagination for WooCommerce product queries?
0 reputation · 27 Nov 2020, 21:30 UTC
Goal: Determine whether offset‑based pagination can be used for WooCommerce product queries without causing unacceptable performance overhead or data inconsistency when dealing with large catalogs.
Constraints: The built‑in WP_Query and REST API rely on page/per_page parameters that trigger a COUNT(*) query to calculate total pages, which becomes expensive on tables with thousands of products. Using an offset argument avoids that extra count but can lead to duplicated or omitted items if products are added or removed between requests.
Uncertainty: WooCommerce core has not exposed a cursor‑based (seek‑after) pagination method, leaving store developers to choose between the current page‑based approach and custom offset‑based solutions.
Does offset‑based pagination reduce server load enough to justify possible inconsistency? Which pagination strategy offers the best balance for stores with more than 10 000 products? Should WooCommerce consider adding a seek‑after cursor endpoint for product lists?