Offset Pagination

오프셋 페이지네이션

Offset and limit select a position, but inserts ahead of it can shift page boundaries.

···
html
<div class="viz"><h3>LIMIT 3 · OFFSET 3</h3><div class="row" id="list"></div><div class="muted" id="status">page 1: A B C</div></div>
css
.viz{width:94%;height:88%;max-width:960px;padding:clamp(10px,2vmin,18px);border:1px solid var(--line);border-radius:14px;background:var(--surface);font:600 clamp(12px,1.35vw,16px)/1.35 var(--font-sans,system-ui,sans-serif);display:flex;flex-direction:column;gap:clamp(7px,1.8vmin,13px);overflow:hidden}.viz h3{margin:0;color:var(--accent);font:700 clamp(12px,1.35vw,16px)/1.2 var(--font-sans,system-ui,sans-serif);letter-spacing:.04em}.viz .row{display:flex;align-items:center;justify-content:center;gap:clamp(5px,1.4vmin,12px);flex:1;min-height:0}.viz .box{padding:clamp(5px,1.5vmin,12px);border:1px solid var(--line);border-radius:9px;background:var(--bg);text-align:center}.viz .muted{color:var(--muted)}.viz .accent{color:var(--accent)}.viz .code{font-family:ui-monospace,monospace}.viz .pill{padding:3px 7px;border:1px solid var(--line);border-radius:99px;white-space:nowrap}.viz .active{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 12%,var(--surface))}.viz .arrow{color:var(--accent);font:700 18px ui-monospace,monospace}#list{gap:4px}#list .box{min-width:13%;padding:8px 2px}#list .duplicate{border-color:var(--accent-3);color:var(--accent-3)}
js
let changed=false;function draw(){changed=!changed;document.getElementById('list').innerHTML=(changed?['NEW','A','B','C','D','E']:['A','B','C','D','E','F']).map((x,i)=>'<span class="box '+(i===3&&changed?'duplicate':i<3?'active':'')+'">'+x+'</span>').join('');document.getElementById('status').textContent=changed?'insert → page 2: C D E (C repeats)':'page 1: A B C · page 2: D E F'}draw();setInterval(draw,1800)

Offset pagination returns a fixed number of rows starting at an offset. It is simple and supports jumping to a page. But an insertion near the front makes the same offset point to a different row.

The demo reads C on page one, inserts a new item at the front, then reads page two with offset=3. C appears again. For changing collections, accept that risk explicitly or use a cursor.

When to use

Use it for small, relatively stable result sets that need numbered pages.

Open as page ↗