Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy
AI

The AI Prompt That Reviews a Pagination Implementation for Pages That Skip or Repeat Rows When New Rows Are Inserted Mid-Scroll

- 01.11.26 - ErcanOPAK

🤖 The AI Prompt That Reviews a Pagination Implementation for Pages That Skip or Repeat Rows When New Rows Are Inserted Mid-Scroll

Offset-based pagination assumes the underlying result set stays still between one page request and the next, and that assumption quietly breaks the moment new rows get inserted, or old ones deleted, while a user is still paging through results – every row’s position can shift by exactly enough to make the next offset either skip a row that moved past it or repeat one that moved back into view. This prompt has an AI assistant trace through a pagination implementation specifically looking for the places where it relies on row position staying fixed across requests, rather than the more commonly checked question of whether the page size and total count math is correct.

🔎 The Problem

THE PROMPT TO USE:

"Here is my pagination implementation [paste the query or code that fetches
each page, including how it computes offset/limit or any cursor it uses].
Assume rows can be inserted or deleted in the underlying table between one
page request and the next. Walk through it and tell me:

1. Does this implementation use a numeric offset (page * page_size) or a
   cursor based on a stable column value from the last row seen?
2. If it's offset-based, trace through a concrete scenario: a user has
   fetched page 1 (rows 1-20 by creation date), then a new row is inserted
   that would sort ahead of row 20. When the user requests page 2 (offset
   20), does the new row push what would have been row 20 back into page 2,
   causing it to appear twice, or does it push row 21 further down, causing
   it to be skipped entirely?
3. Check whether the sort order used for pagination is actually stable and
   unique - sorting only by a non-unique column (like creation date alone,
   with no tiebreaker) can reorder rows with identical values between
   requests even with no inserts or deletes at all.
4. If a cursor-based approach would avoid this, tell me specifically what
   stable, unique column (or combination) to cursor on given this schema."

WHY IT WORKS: pagination bugs almost never show up in a test with a static,
unchanging dataset, so asking the model to specifically trace an insert or
delete happening mid-scroll surfaces exactly the failure mode that a normal
fixed-dataset test can never expose.

✅ What a Good Answer Looks Like

  • A concrete walkthrough of the skip-or-repeat scenario using this specific implementation’s actual offset or cursor logic, not a generic explanation of pagination theory.
  • An explicit check of whether the sort order includes a unique tiebreaker column, since that gap causes problems even without any inserts or deletes happening at all.
  • A specific, schema-aware recommendation for a cursor column or combination when a switch away from offset-based paging is the right call, not just a generic suggestion to use cursors.

🚨 What to Watch Out For

  • Be skeptical of an answer that says offset pagination is fine because the table doesn’t change often – even a low-frequency insert or delete is still enough to skip or repeat exactly one row for exactly one user at exactly the wrong moment, and that’s precisely the kind of bug report that’s nearly impossible to reproduce after the fact.

Offset pagination asks every row to hold still between requests, and the instant a single insert or delete happens mid-scroll, that’s a promise the underlying data was never actually making.

— AI Power User

Related posts:

The AI Prompt That Turns a Vague Feature Request Into Clear Acceptance Criteria

The AI Prompt That Turns a Vague Feature Request Into Clear Acceptance Criteria

Plan a Real-Life Skill Upgrade in 30 Days

Plan a Real-Life Skill Upgrade in 30 Days

AI Prompt — Home Repair Planning

AI Prompt — Home Repair Planning

Views: 6

Post navigation

Windows 11: Fix Storage Sense Silently Skipping the Downloads Folder Because It Was Redirected to a Second Drive
Git: Fix git bisect Marking a Commit Good or Bad Based on a Stale Build Artifact Left Over From the Previous Checkout

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

November 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« Oct    

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,055)
  • Get the User Name and Domain Name from an Email Address in SQL (981)
  • How to add default value for Entity Framework migrations for DateTime and Bool (977)
  • Get the First and Last Word from a String or Sentence in SQL (858)
  • How to select distinct rows in a datatable in C# (854)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (653)
  • Add Constraint to SQL Table to ensure email contains @ (609)
  • Average of all values in a column that are not zero in SQL (570)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (547)
  • Find numbers with more than two decimal places in SQL (475)

Recent Posts

  • C#: Fix a ConditionalWeakTable Entry Vanishing Too Soon
  • Docker: Fix a Stale COPY Layer After Editing .dockerignore
  • Photoshop: Fix a Pattern Overlay Scaling Wrong on a High-DPI File
  • SQL Server: Fix a Computed Column Index Skipped by Implicit Cast
  • HTML5: Fix a required Input Inside a Hidden Tab Blocking Submit
  • SQL Server: Fix ROW_NUMBER Ties Reordering Between Identical Runs
  • C#: Fix an Enum HasFlag Returning True for the Zero Value
  • WordPress: Fix Featured Images Vanishing After a CDN Migration
  • Photoshop: Fix Content-Aware Fill Smearing a Repeating Pattern
  • Asp.Net Core: Fix Antiforgery Tokens Rejected Behind a Reverse Proxy

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,055)
  • Get the User Name and Domain Name from an Email Address in SQL (981)
  • How to add default value for Entity Framework migrations for DateTime and Bool (977)
  • Get the First and Last Word from a String or Sentence in SQL (858)
  • How to select distinct rows in a datatable in C# (854)

Recent Posts

  • C#: Fix a ConditionalWeakTable Entry Vanishing Too Soon
  • Docker: Fix a Stale COPY Layer After Editing .dockerignore
  • Photoshop: Fix a Pattern Overlay Scaling Wrong on a High-DPI File
  • SQL Server: Fix a Computed Column Index Skipped by Implicit Cast
  • HTML5: Fix a required Input Inside a Hidden Tab Blocking Submit

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com