The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.
Follows the import procedure in README.md.
source/ the originating repository verbatim — 78 documents, 28 SVGs,
8 manifests, plus .source-revision recording the commit
final/ the SSOT
document.md 729 lines written from the 29 experiment documents, not
concatenated: what was predicted, what was measured, and
where the measurement itself was wrong
evidence/raw 125 outputs, flattened to <experiment>__<file> because
the originals collided (01-baseline.txt appeared three
times) and the audit only globs the top level
evidence/meta one per raw file; command and exitCode are null and the
README says why rather than inventing them
evidence/browser 22 captures
assets/ three diagrams through techviz
.techviz/ their VizSpecs
A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.
Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.
verify-pipeline.py passes. audit-records.py reports no issues.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
53 lines
2.1 KiB
Markdown
53 lines
2.1 KiB
Markdown
---
|
|
kind: CONCEPT
|
|
slug: adapter-outbound-persistence-jpa-c29
|
|
title: size + 1로 hasNext를 판정하고 COUNT를 없앤다
|
|
topic: query-and-pagination-models
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: concept:adapter-outbound-persistence-jpa-c29
|
|
evidenceCapturedOn: 2026-09-01
|
|
assets:
|
|
- key: adapter-outbound-persistence-jpa-c29
|
|
file: ../../../final/evidence/rendered/adapter-outbound-persistence-jpa-c29.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/adapter-outbound-persistence-jpa-c29.txt
|
|
source:
|
|
- 원본 분석 절은 analysis/05-adapter-outbound-persistence-jpa.md#L1973 이다.
|
|
module: adapter-outbound-persistence-jpa
|
|
---
|
|
|
|
# size + 1로 hasNext를 판정하고 COUNT를 없앤다
|
|
|
|
`JpaKeysetQuerySupport`는 `size + 1`을 가져와 최대 `size`개를 반환하고 추가 1개로 `hasNext`를 판단한다. 이 path에는 `COUNT(*)`가 없다.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
`JpaKeysetQuerySupport`의 실행 형태는 이렇다.
|
|
|
|
```text
|
|
query.setMaxResults(page.fetchSize()) // size + 1
|
|
-> result
|
|
-> KeysetSliceAssembler
|
|
```
|
|
|
|
반환은 최대 `size`개이고 추가 1개로 `hasNext`를 판단한다. 이 path에는 `COUNT(*)`가 없다.
|
|
|
|
## JpaKeysetQuerySupport 참조 위치
|
|
|
|
:::evidence key="adapter-outbound-persistence-jpa-c29" alt="코드베이스에서 JpaKeysetQuerySupport 를 검색한 출력 6줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="JpaKeysetQuerySupport 코드베이스 검색 — 6줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
## COUNT를 다시 붙이지 않는 이유
|
|
|
|
keyset을 도입해 OFFSET full-walk 비용을 줄여 놓고 total count로 다시 full-work를 추가하는 구조를 피한다.
|
|
|
|
## 별도 레인에서만 확인한 것
|
|
|
|
실제 PostgreSQL readiness query도 `(occurred_at,id) > (?,?) ORDER BY ... LIMIT ?` 형태와 representative index 사용을 별도 integration lane에서 검증한다. 해당 entire integration lane 자체는 later sub-scope 11의 denominator이므로 여기서는 cross-scope evidence로만 사용한다.
|
|
|
|
<!-- body:end -->
|