Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

  • Understand the issue and current implementation
  • Create KeysetPagination component for cursor-based pagination
  • Create KeysetDataProvider for efficient database queries
  • Update UserController to use keyset pagination instead of offset pagination
  • Update views/user/index.php to support keyset pagination links
  • Remove temporary redirect from actionIndex

Changes Made

This PR implements keyset/cursor pagination for the users list page to reduce MySQL load.

New Components:

  1. components/KeysetPagination.php - Handles cursor encoding/decoding and URL generation for prev/next navigation
  2. components/KeysetDataProvider.php - Data provider that uses indexed columns (rank, id) for pagination instead of OFFSET

Modified Files:

  1. controllers/UserController.php - Updated actionIndex() to use KeysetDataProvider instead of ActiveDataProvider
  2. views/user/index.php - Updated to render table manually with keyset pagination nav (prev/next buttons)

How Keyset Pagination Works:

  • Instead of OFFSET n, uses WHERE rank > :lastRank OR (rank = :lastRank AND id > :lastId)
  • This leverages database indexes for O(1) page navigation regardless of page depth
  • Encodes cursor position as base64 JSON containing the key column values
  • Supports bidirectional navigation (next/prev pages)
Original prompt

This section details on the original issue you should resolve

<issue_title>Redo users list page using keyset / cursor pagination</issue_title>
<issue_description>Offset pagination creates too much load on MySQL.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Copilot AI changed the title [WIP] Redo users list page using keyset cursor pagination Implement keyset/cursor pagination for users list page Dec 2, 2025
Copilot AI requested a review from samdark December 2, 2025 08:50
Copilot finished work on behalf of samdark December 2, 2025 08:50
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Copilot AI requested a review from samdark December 4, 2025 18:50
Copilot finished work on behalf of samdark December 4, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redo users list page using keyset / cursor pagination

2 participants