Skip to content
Back to skills

Django Pagination Performance

ASecurity

Improve Django and Django REST Framework pagination for large querysets using bounded page sizes, stable ordering, indexed ordering, offset limits, keyset pagination, DRF CursorPagination, and count-query tradeoffs. Use when list pages, admin views, APIs, exports, or infinite scroll become slow, inconsistent, or memory-heavy as result sets grow.

  • 3 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 12, 2026
ai-agentsgosqldjangogitapidatabaseperformance

Works with

  • cursor
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 12, 2026

npx -y skills add thedixitjain/the-mega-skill-library --skill django-pagination-performance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Django Pagination Performance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Django Pagination Performance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/thedixitjain-django-pagination-performance/badge)](https://www.skillsdirectory.com/skills/thedixitjain-django-pagination-performance)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: django-pagination-performance
description: "Improve Django and Django REST Framework pagination for large querysets using bounded page sizes, stable ordering, indexed ordering, offset limits, keyset pagination, DRF CursorPagination, and count-query tradeoffs. Use when list pages, admin views, APIs, exports, or infinite scroll become slow, inconsistent, or memory-heavy as result sets grow."
category: engineering-core
source_repo: hashgraph-online/awesome-codex-plugins
source_path: "plugins/LVTD-LLC/skills/skills/django-pagination-performance/SKILL.md"
source_url: https://github.com/hashgraph-online/awesome-codex-plugins/blob/HEAD/plugins/LVTD-LLC/skills/skills/django-pagination-performance/SKILL.md
---


# Django Pagination Performance

Use this skill when a Django list view or API slows down as pages get deeper or result sets grow. Pagination is a query-design problem as much as a response-shaping problem.

## Workflow

1. Confirm the list contract.
   - Is arbitrary page access required, or only next/previous?
   - Does the UI need a total count?
   - Can ordering be fixed and stable?
   - What page size limit is acceptable?

2. Measure the current query.
   - Capture SQL for the page query and count query.
   - Check ordering, indexes, and high page numbers.
   - Use `QuerySet.explain()` for deep pages.

3. Choose the pagination style.
   - Use Django `Paginator` for moderate result sets and arbitrary page access.
   - Use capped offset pagination when page numbers are useful but deep pages should be limited.
   - Use keyset/cursor pagination for large feeds, timelines, logs, and infinite scroll.
   - Use DRF `CursorPagination` for API next/previous navigation with stable ordering.

4. Make ordering deterministic.
   - Use a unique or nearly unique immutable ordering field.
   - Add a primary-key tie breaker when needed.
   - Ensure the index matches filters plus ordering.

See [pagination-patterns.md](references/pagination-patterns.md) for Django and DRF examples.

## Safety Notes

- Deep `LIMIT/OFFSET` pages can be slow because the database still walks skipped rows.
- Unordered querysets produce inconsistent pages.
- Cursor pagination restricts arbitrary page jumps and user-controlled ordering.
- Large exact counts can dominate list latency.

## Verification

Measure first page, representative deep page, count query, and insertion/deletion consistency for the chosen pagination contract.

---

**Source:** [`hashgraph-online/awesome-codex-plugins`](https://github.com/hashgraph-online/awesome-codex-plugins) → `plugins/LVTD-LLC/skills/skills/django-pagination-performance/SKILL.md`

Files in this skill

  • SKILL.md2.6 KB
  • references/pagination-patterns.md2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.