feat(managementapi): serve the maven remote package and version reads (S17 Phase 6 plan: 15/42)

Why

Phase 6 Step 13 restructured the three artifact-read kind gates into explicit dispatch, with each format's remote arm answering a placeholder 404 until its read step fills it. This fills the Maven package and version arms.

Until it lands, a Maven remote repository's cache tables fill but nothing can read them: every package and version route answers 404 whatever the cache holds. Step 16 (Maven remote file reads) verifies the version-to-package chain through these finders, so it depends on this.

Plan: Step 15. Spec: S17 AC #95 and #97, Maven package and version slices.

What is worth a reviewer's attention

The error-string convention here reverses what commit a5f501f06's body says. That body records a resolved ambiguity as "the Maven remote stores keep the hosted Maven stores' identifier-carrying error strings". Review reversed it. The four new store wraps are identifier-free, per database-query-patterns.md's "the rule attaches when a method is added", and every row id they dropped is now a structured field at the call site. TestMavenRemoteReads_StoreFailureLogsTheRowIdentifiers pins all five sites. Read the code, not that commit body.

Two facts drove the reversal. container_remote_manifests.go is already identifier-free, so the merged container step is internally inconsistent rather than a convention to match. And maven_remote_versions.go contradicted itself: AddMavenRemoteVersionSizeBytes cites the rule for its own wrap. The remaining identifier-carrying remote stores want one sweep, not a per-step conversion.

No cache key on these responses, deliberately. AC #96 (closed) puts it on files and container tags only and excludes packages, versions, images, and manifests. It arrives with Step 16.

Both sorts are served, though the plan's Files bullet names only created_at. That bullet is not the constraint. The step's Acceptance bullet says "Phase 3's sorts", and the spec's Phase 3 table gives the versions list both created_at and version. The version sort rides unique_maven_remote_versions_ns_id_pkg_id_version from migration 20260731130000, not a Step 2 index, which is why Step 2's bullet does not mention it.

resolveFormatChildRow now returns the parent repositories.id it used to discard. The kind and the parent id come from one statement instead of two that could disagree. That is where the single-source property lives, so the packageScope wrapper is gone too and the four package branches take a plain namespaceID.

One behavior change lands outside the Maven remote path. The package detail reads share the version family's classifier now, detailRowFound, and their three 500 messages no longer end in "error" (they composed "...lookup error: the store returned a nil row without an error"). Log-only, and only TestMavenRemoteReads_StoreFailureLogsTheRowIdentifiers pinned any of them.

A remote Maven version serves size as null, not 0. Nothing writes maven_remote_versions.size_bytes: the upsert omits it cold and leaves it on conflict, and AddMavenRemoteVersionSizeBytes has no caller outside its own tests. Serving the stored zero told a client a 5 MB jar was empty. The npm twin's writer is equally uncalled, but no npm remote version resource is served yet, so this is the first surface to answer with a remote row's size and the call is this MR's. api/openapi/v1.yaml says what a remote row carries for both size and created_at, whose description dated the row from publish when a cache row records only when it was fetched.

Rolling-deploy skew: during one deploy window a client following a Link cursor into a pre-MR pod gets the old 404. No cursor is misread.

Reviewable LOC

7022 insertions across 30 files, past the 500 line. Split: 1820 production across 17 files, 5202 test across 13, of which 2077 is the two new integration suites. The four production files carrying it are maven_remote_versions.go (497), maven_remote_packages.go (446), packages.go (389), and versions.go (275).

Splitting does not help. The stores and the handler arms that consume them cannot merge apart without shipping a dispatch arm that 404s on its own store, so the only available cut is tests-from-code. The 2.8x test ratio is what the step's acceptance asks for: keyset walks in both directions on both sorts, EXPLAIN plan pins at 5000 seeded rows, and soft-delete invisibility at both chain levels.

Test plan

Unit and integration suites in internal/datastore and internal/managementapi. Integration needs Postgres with max_locks_per_transaction=4096 (#657):

export ARTIFACT_REGISTRY_DATABASE_TEST_DSN=...
go test -tags=integration ./internal/datastore/ -run MavenRemote -count=1
go test -tags=integration ./internal/managementapi/ -count=1

Verified green, plus go build ./..., go vet in both tag modes, and golangci-lint with --max-same-issues=0 --max-issues-per-linter=0 --uniq-by-line=false in both tag modes reporting zero findings on this branch's files.

EXPLAIN pins assert index-backed scans in both directions with no post-scan Sort and no Rows Removed by Filter, at 5000 seeded rows, plus single-partition pruning and a primary-key seek on each detail read.

E2e scenario impact: none. docs/testing/e2e/maven.md scopes remote and proxy Maven repositories out to S30 and S14, and the catalogs are protocol-client driven while this is a management-surface read.

Known gaps, deliberate

No test drives the full repositories(kind=2)maven_repositoriesmaven_remote_repositories → cache-row chain against a real database. It is not reachable today: CreateMavenRemoteRepository has no production caller and the create handler still rejects every non-hosted kind. Step 16 needs the same rig and should carry it.

Spec coverage table

Spec: docs/specs/S17-rest-management-api.md

Acceptance criteria

# Criterion (this step's slice) Tests
AC #95 Maven package and version lists and details serve a remote repository from its cache tables TestMavenRemotePackageList_ServesTheCache, TestMavenRemotePackageDetail_ServesTheCache, TestMavenRemoteVersionList_ServesTheCache, TestMavenRemoteVersion_PublishAttributionIsNull, TestMavenRemotePackageStore_ReadsWhatTheCacheFillWrote, TestMavenRemoteVersionStore_ReadsWhatTheCacheFillWrote
AC #95 ... with Phase 3's sorts TestMavenRemotePackageList_HonoursQueryParameters, TestMavenRemoteVersionList_ServesTheCache/sort=version_reaches_the_store, TestMavenRemotePackageStore_ListMavenRemotePackages_KeysetWalkBothDirections, TestMavenRemoteVersionStore_ListMavenRemoteVersionsByPackage_KeysetWalkBothSorts, TestListMavenRemoteVersionsByPackageStmt
AC #95 ... with Phase 3's pagination (keyset, Link, hasMore) TestMavenRemotePackageList_HonoursQueryParameters/a_Link_walk_covers_every_cached_package_exactly_once, TestMavenRemoteVersionList_ServesTheCache/a_Link_walk_covers_every_cached_version_exactly_once, TestMavenRemotePackageStore_ListMavenRemotePackages_HasMoreSignal, TestMavenRemoteVersionStore_ListMavenRemoteVersionsByPackage_HasMoreSignal, TestMavenRemotePackageStore_ListMavenRemotePackages_UnmatchedCursor, TestMavenRemoteVersionStore_ListMavenRemoteVersionsByPackage_UnmatchedCursor, TestMavenRemotePackageList_BackwardWalkRetraces, TestMavenRemoteVersionList_BackwardWalkRetraces, TestMavenRemotePackageStore_ListMavenRemotePackages_AcceptsBoundaryLimit, TestMavenRemoteVersionStore_ListMavenRemoteVersionsByPackage_AcceptsBoundaryLimit
AC #95 ... with Phase 3's error rules TestMavenRemoteReads_InvalidQueryIs400, TestMavenRemoteReads_VirtualRepositoryIs404, TestMavenRemoteReads_StoreFailureIs500
AC #95 ... and a coordinate the upstream serves but nobody has pulled is absent TestMavenRemoteReads_UpstreamOnlyCoordinateIsAbsent
AC #95 ... scoped to the tenant and the remote repository in the URL TestMavenRemotePackageStore_ListMavenRemotePackages_ChainScoping, TestMavenRemoteVersionStore_ListMavenRemoteVersionsByPackage_ChainScoping, TestMavenRemotePackageStore_FindMavenRemotePackageInRepository, TestMavenRemoteVersionStore_FindMavenRemoteVersionByID
AC #95 Maven file and container/npm slices Out of scope: Steps 16-20. TestMavenRemoteReads_NeighbouringRoutesKeepTheir404 pins that the Maven file routes still answer their 404 on the repository this step serves.
AC #96 (closed) Packages and versions omit the cache key TestMavenRemotePackageDetail_ServesTheCache, TestMavenRemoteVersion_PublishAttributionIsNull (both response shapes), plus raw-JSON NotContains assertions on list and detail bodies
AC #96 (closed) Files and container tags carry cache Out of scope: Steps 16, 18, 20.
AC #97 (closed) Remote version publish attribution serializes null (created_by, project_id, git_commit_sha) TestMavenRemoteVersion_PublishAttributionIsNull, TestMavenRemoteVersionColumns_CarryNoPublishAttribution
AC #97 (closed) npm package counters, container tag timestamps, npm file created_at, manifest artifact_type and subject_digest Out of scope: Steps 17-20.
AC #100 (closed) An evicted-but-unreaped row (soft_deleted_at) is absent from every list and detail read TestMavenRemoteReads_MarkedRowIsAbsent, TestMavenRemotePackageStore_SoftDeletedPackageIsInvisibleToReads, TestMavenRemoteVersionStore_SoftDeleteIsInvisibleAtBothLevels, TestMavenRemotePackageStore_ListMavenRemotePackages_HasMoreSignal, TestMavenRemoteVersionStore_ListMavenRemoteVersionsByPackage_HasMoreSignal

Error cases

Condition Tests
Repository kind is virtual404 TestMavenRemoteReads_VirtualRepositoryIs404
Parent or artifact id missing, not a valid UUID, soft-deleted, or outside the chain → 404 TestMavenRemoteReads_UpstreamOnlyCoordinateIsAbsent, TestMavenRemoteReads_MarkedRowIsAbsent, TestMavenRemotePackageStore_FindMavenRemotePackageInRepository, TestMavenRemoteVersionStore_FindMavenRemoteVersionByID, TestMavenRemoteVersionStore_SoftDeleteIsInvisibleAtBothLevels
Invalid sort, order, limit, or an undecodable or boundary-free cursor → 400 TestMavenRemoteReads_InvalidQueryIs400, TestMavenRemotePackageStore_ListMavenRemotePackages_ArgumentGuards, TestMavenRemoteVersionStore_ListMavenRemoteVersionsByPackage_ArgumentGuards, TestValidMavenRemoteVersionCursor
Unexpected server failure → 500, with row ids as log fields TestMavenRemoteReads_StoreFailureIs500, TestMavenRemoteReads_StoreFailureLogsTheRowIdentifiers, TestMavenRemotePackageStore_ListMavenRemotePackages_QueryFailure, TestMavenRemoteVersionStore_ListMavenRemoteVersionsByPackage_QueryFailure, TestMavenRemoteVersionStore_ZeroValueReadsFailClosed
npm dist-tag and npm package routes on a remote repository → 404 Pre-existing TestPackageSubtreeRoutes_NonHostedRepositoryIs404
Maven file routes and the Maven version delete on a remote repository → 404 TestMavenRemoteReads_NeighbouringRoutesKeepTheir404, pre-existing TestVersionFileRoutes_NonHostedRepositoryIs404, TestFileDeleteHandler_MavenNotFoundCases
Repository format differs from the :format segment → 404 Pre-existing TestVersionFileRoutes_NonHostedRepositoryIs404 and the package-family format sweeps. Unchanged by this step.
Slug resolves to no namespace → 404 Pre-existing TestHandler_UnknownSlug_Returns404WithEnvelope. Unchanged by this step.
Authentication or authorization failure → 401/403 Owned by S08 and S09, both stubbed, so no route here can produce either.

Security considerations

Concern Tests
Tenant isolation: every query scoped by namespace_id, full parent chain verified from the URL down TestMavenRemotePackageStore_ListMavenRemotePackages_ChainScoping, TestMavenRemoteVersionStore_ListMavenRemoteVersionsByPackage_ChainScoping, TestMavenRemotePackageStore_FindMavenRemotePackageInRepository, TestMavenRemoteVersionStore_FindMavenRemoteVersionByID, TestFindMavenRemotePackageInRepositoryStmt, TestMavenRemotePackageInRepositoryProbeStmt
Existence hiding: a guessed id from another repository or namespace answers the same 404 TestMavenRemotePackageStore_FindMavenRemotePackageInRepository, TestMavenRemoteVersionStore_FindMavenRemoteVersionByID, TestMavenRemoteReads_MarkedRowIsAbsent, TestMavenRemoteReads_UpstreamOnlyCoordinateIsAbsent
Injection: Jet builder with bound parameters throughout TestListMavenRemotePackagesStmt, TestListMavenRemoteVersionsByPackageStmt (cursor values asserted as binds, never inlined), plus both _ArgumentGuards rejecting NUL and control bytes
Attribution exposure: version responses carry opaque GitLab references TestMavenRemoteVersion_PublishAttributionIsNull — a remote row stores none, so all three serialize null
Read cost: reads stay partition-pruned and index-bound TestMavenRemotePackageStore_ListMavenRemotePackages_DeepPageIsIndexBacked, TestMavenRemoteVersionStore_ListMavenRemoteVersionsByPackage_DeepPageIsIndexBacked, TestFindMavenRemotePackageInRepositoryStmt_SinglePartitionPrune, TestFindMavenRemoteVersionByIDStmt_SinglePartitionPrune
Upstream credentials, SSRF, URL retarget, write authorization Not reachable from a read route here. The resolver discards the resolved repository's URL, and the finder never selects the credential columns.

Database Review Evidence

Queries

Note

Plans are from EXPLAIN (ANALYZE, BUFFERS) against an ephemeral PostgreSQL 17.10 container (matching GL_PG_CURR_VERSION from .gitlab-ci-other-versions.yml), with synthesized seed data and the container torn down at the end of the run. Numbers reflect moderate cardinality and do not capture production-scale effects. See Database review evidence for seed sizing, methodology, and the anomalies the skill flags. Expand each row's details for the seed shape, rendered SQL, bound args, and raw plan.

Two methodology notes for this MR. The suites in internal/datastore/maven_remote_*_integration_test.go pin these same statements on a connection with enable_seqscan = off; this evidence was collected without that pin, and all 15 statements still reach the same index, so the pin is not masking a Seq Scan the planner would otherwise prefer. And the first statement to touch each table in a fresh backend pays about 3 ms of planning to open 64 partitions' metadata (visible as Planning: Buffers: shared hit=503 / hit=614); every later statement in the same session plans in 0.08-0.28 ms, and a pooled connection pays it once.

Method Plan node Index Rows (plan / actual) Cost Time Buffers (hit / read) Partitions
MavenRemotePackageStore.ListMavenRemotePackages.CursorNil_Asc Index Scan unique_maven_remote_packages_ns_id_repo_id_group_artifact 101 / 101 11.74 0.051ms 6 / 0 1/64
MavenRemotePackageStore.ListMavenRemotePackages.CursorNil_Desc Index Scan Backward unique_maven_remote_packages_ns_id_repo_id_group_artifact 101 / 101 11.74 0.070ms 8 / 0 1/64
MavenRemotePackageStore.ListMavenRemotePackages.CursorSet_Asc Index Scan unique_maven_remote_packages_ns_id_repo_id_group_artifact 101 / 101 14.18 0.075ms 7 / 0 1/64
MavenRemotePackageStore.ListMavenRemotePackages.CursorSet_Desc Index Scan Backward unique_maven_remote_packages_ns_id_repo_id_group_artifact 101 / 101 18.48 0.073ms 7 / 0 1/64
MavenRemotePackageStore.FindMavenRemotePackageInRepository Index Scan pk_maven_remote_packages 1 / 1 8.30 0.027ms 3 / 0 1/64
MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.CreatedAt_Asc_CursorNil Index Scan index_maven_remote_versions_on_ns_id_pkg_id_created_at_id 101 / 101 10.09 0.042ms 5 / 0 1/64
MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.CreatedAt_Asc_CursorSet Index Scan index_maven_remote_versions_on_ns_id_pkg_id_created_at_id 101 / 101 16.06 0.038ms 5 / 0 1/64
MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.CreatedAt_Desc_CursorNil Index Scan Backward index_maven_remote_versions_on_ns_id_pkg_id_created_at_id 101 / 101 10.09 0.044ms 6 / 0 1/64
MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.CreatedAt_Desc_CursorSet Index Scan Backward index_maven_remote_versions_on_ns_id_pkg_id_created_at_id 101 / 101 12.12 0.031ms 6 / 0 1/64
MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.Version_Asc_CursorNil Index Scan unique_maven_remote_versions_ns_id_pkg_id_version 101 / 101 9.20 0.031ms 5 / 0 1/64
MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.Version_Asc_CursorSet Index Scan unique_maven_remote_versions_ns_id_pkg_id_version 101 / 101 15.37 0.031ms 5 / 0 1/64
MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.Version_Desc_CursorNil Index Scan Backward unique_maven_remote_versions_ns_id_pkg_id_version 101 / 101 9.20 0.027ms 4 / 0 1/64
MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.Version_Desc_CursorSet Index Scan Backward unique_maven_remote_versions_ns_id_pkg_id_version 101 / 101 11.17 0.029ms 6 / 0 1/64
MavenRemoteVersionStore.FindMavenRemoteVersionByID.VersionLeg Index Scan unique_maven_remote_versions_id_pkg_id_ns_id 1 / 1 8.30 0.019ms 3 / 0 1/64
MavenRemoteVersionStore.FindMavenRemoteVersionByID.ParentPackageLeg Index Scan pk_maven_remote_packages 1 / 1 8.30 0.012ms 3 / 0 1/64
MavenRemotePackageStore.ListMavenRemotePackages.CursorNil_Asc

Summary: Plan matches the method's intent: a Limit over a forward scan of unique_maven_remote_packages_ns_id_repo_id_group_artifact, with namespace_id pruning to 1 of 64 partitions. The coordinate order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.086 ms against 5000 cached packages in the target remote repository. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_packages.namespace_id AS "maven_remote_packages.namespace_id",
     maven_remote_packages.id AS "maven_remote_packages.id",
     maven_remote_packages.maven_remote_repository_id AS "maven_remote_packages.maven_remote_repository_id",
     maven_remote_packages.last_downloaded_at AS "maven_remote_packages.last_downloaded_at",
     maven_remote_packages.soft_deleted_at AS "maven_remote_packages.soft_deleted_at",
     maven_remote_packages.group_id AS "maven_remote_packages.group_id",
     maven_remote_packages.artifact_id AS "maven_remote_packages.artifact_id"
FROM public.maven_remote_packages
WHERE ((maven_remote_packages.namespace_id = $1::uuid) AND (maven_remote_packages.maven_remote_repository_id = $2::uuid)) AND (maven_remote_packages.soft_deleted_at IS NULL)
ORDER BY maven_remote_packages.group_id ASC, maven_remote_packages.artifact_id ASC
LIMIT $3;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, 69b3e130-1e77-4abf-a9ed-97e3276658f1, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.41..11.74 rows=101 width=99) (actual time=0.029..0.051 rows=101 loops=1)
  Buffers: shared hit=6
  ->  Index Scan using maven_remote_packages_p57_namespace_id_maven_remote_reposit_idx on maven_remote_packages_p57 maven_remote_packages  (cost=0.41..561.60 rows=5000 width=99) (actual time=0.028..0.042 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_repository_id = '69b3e130-1e77-4abf-a9ed-97e3276658f1'::uuid))
        Buffers: shared hit=6
Planning:
  Buffers: shared hit=503
Planning Time: 3.296 ms
Execution Time: 0.086 ms

Timings: planning 3.296ms, execution 0.086ms, total 3.382ms.

MavenRemotePackageStore.ListMavenRemotePackages.CursorNil_Desc

Summary: Plan matches the method's intent: a Limit over a backward scan of unique_maven_remote_packages_ns_id_repo_id_group_artifact, with namespace_id pruning to 1 of 64 partitions. The coordinate order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.098 ms against 5000 cached packages in the target remote repository. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_packages.namespace_id AS "maven_remote_packages.namespace_id",
     maven_remote_packages.id AS "maven_remote_packages.id",
     maven_remote_packages.maven_remote_repository_id AS "maven_remote_packages.maven_remote_repository_id",
     maven_remote_packages.last_downloaded_at AS "maven_remote_packages.last_downloaded_at",
     maven_remote_packages.soft_deleted_at AS "maven_remote_packages.soft_deleted_at",
     maven_remote_packages.group_id AS "maven_remote_packages.group_id",
     maven_remote_packages.artifact_id AS "maven_remote_packages.artifact_id"
FROM public.maven_remote_packages
WHERE ((maven_remote_packages.namespace_id = $1::uuid) AND (maven_remote_packages.maven_remote_repository_id = $2::uuid)) AND (maven_remote_packages.soft_deleted_at IS NULL)
ORDER BY maven_remote_packages.group_id DESC, maven_remote_packages.artifact_id DESC
LIMIT $3;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, 69b3e130-1e77-4abf-a9ed-97e3276658f1, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.41..11.74 rows=101 width=99) (actual time=0.036..0.070 rows=101 loops=1)
  Buffers: shared hit=8
  ->  Index Scan Backward using maven_remote_packages_p57_namespace_id_maven_remote_reposit_idx on maven_remote_packages_p57 maven_remote_packages  (cost=0.41..561.60 rows=5000 width=99) (actual time=0.035..0.061 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_repository_id = '69b3e130-1e77-4abf-a9ed-97e3276658f1'::uuid))
        Buffers: shared hit=8
Planning:
  Buffers: shared hit=6
Planning Time: 0.278 ms
Execution Time: 0.098 ms

Timings: planning 0.278ms, execution 0.098ms, total 0.376ms.

MavenRemotePackageStore.ListMavenRemotePackages.CursorSet_Asc

Summary: Plan matches the method's intent: a Limit over a forward scan of unique_maven_remote_packages_ns_id_repo_id_group_artifact, with namespace_id pruning to 1 of 64 partitions. The (group_id, artifact_id) row-value bound folds into the Index Cond rather than re-checking as a post-scan Filter, and the coordinate order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.137 ms against 5000 cached packages in the target remote repository. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_packages.namespace_id AS "maven_remote_packages.namespace_id",
     maven_remote_packages.id AS "maven_remote_packages.id",
     maven_remote_packages.maven_remote_repository_id AS "maven_remote_packages.maven_remote_repository_id",
     maven_remote_packages.last_downloaded_at AS "maven_remote_packages.last_downloaded_at",
     maven_remote_packages.soft_deleted_at AS "maven_remote_packages.soft_deleted_at",
     maven_remote_packages.group_id AS "maven_remote_packages.group_id",
     maven_remote_packages.artifact_id AS "maven_remote_packages.artifact_id"
FROM public.maven_remote_packages
WHERE (((maven_remote_packages.namespace_id = $1::uuid) AND (maven_remote_packages.maven_remote_repository_id = $2::uuid)) AND (maven_remote_packages.soft_deleted_at IS NULL)) AND ((maven_remote_packages.group_id, maven_remote_packages.artifact_id) > ($3::text, $4::text))
ORDER BY maven_remote_packages.group_id ASC, maven_remote_packages.artifact_id ASC
LIMIT $5;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, 69b3e130-1e77-4abf-a9ed-97e3276658f1, com.example.g00025, artifact-002500, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.41..14.18 rows=101 width=99) (actual time=0.036..0.075 rows=101 loops=1)
  Buffers: shared hit=7
  ->  Index Scan using maven_remote_packages_p57_namespace_id_maven_remote_reposit_idx on maven_remote_packages_p57 maven_remote_packages  (cost=0.41..429.15 rows=3144 width=99) (actual time=0.035..0.065 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_repository_id = '69b3e130-1e77-4abf-a9ed-97e3276658f1'::uuid) AND (ROW(group_id, artifact_id) > ROW('com.example.g00025'::text, 'artifact-002500'::text)))
        Buffers: shared hit=7
Planning:
  Buffers: shared hit=1
Planning Time: 0.244 ms
Execution Time: 0.137 ms

Timings: planning 0.244ms, execution 0.137ms, total 0.381ms.

MavenRemotePackageStore.ListMavenRemotePackages.CursorSet_Desc

Summary: Plan matches the method's intent: a Limit over a backward scan of unique_maven_remote_packages_ns_id_repo_id_group_artifact, with namespace_id pruning to 1 of 64 partitions. The (group_id, artifact_id) row-value bound folds into the Index Cond rather than re-checking as a post-scan Filter, and the coordinate order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.108 ms against 5000 cached packages in the target remote repository. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_packages.namespace_id AS "maven_remote_packages.namespace_id",
     maven_remote_packages.id AS "maven_remote_packages.id",
     maven_remote_packages.maven_remote_repository_id AS "maven_remote_packages.maven_remote_repository_id",
     maven_remote_packages.last_downloaded_at AS "maven_remote_packages.last_downloaded_at",
     maven_remote_packages.soft_deleted_at AS "maven_remote_packages.soft_deleted_at",
     maven_remote_packages.group_id AS "maven_remote_packages.group_id",
     maven_remote_packages.artifact_id AS "maven_remote_packages.artifact_id"
FROM public.maven_remote_packages
WHERE (((maven_remote_packages.namespace_id = $1::uuid) AND (maven_remote_packages.maven_remote_repository_id = $2::uuid)) AND (maven_remote_packages.soft_deleted_at IS NULL)) AND ((maven_remote_packages.group_id, maven_remote_packages.artifact_id) < ($3::text, $4::text))
ORDER BY maven_remote_packages.group_id DESC, maven_remote_packages.artifact_id DESC
LIMIT $5;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, 69b3e130-1e77-4abf-a9ed-97e3276658f1, com.example.g00025, artifact-002500, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.41..18.48 rows=101 width=99) (actual time=0.037..0.073 rows=101 loops=1)
  Buffers: shared hit=7
  ->  Index Scan Backward using maven_remote_packages_p57_namespace_id_maven_remote_reposit_idx on maven_remote_packages_p57 maven_remote_packages  (cost=0.41..319.88 rows=1785 width=99) (actual time=0.036..0.063 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_repository_id = '69b3e130-1e77-4abf-a9ed-97e3276658f1'::uuid) AND (ROW(group_id, artifact_id) < ROW('com.example.g00025'::text, 'artifact-002500'::text)))
        Buffers: shared hit=7
Planning:
  Buffers: shared hit=1
Planning Time: 0.261 ms
Execution Time: 0.108 ms

Timings: planning 0.261ms, execution 0.108ms, total 0.369ms.

MavenRemotePackageStore.FindMavenRemotePackageInRepository

Summary: Plan matches the method's intent: a one-row seek on pk_maven_remote_packages (id, namespace_id), pruning to 1 of 64 partitions. maven_remote_repository_id and soft_deleted_at ride as heap filters on the single seeked row rather than widening the probe into a range scan, which is what the builder's doc comment claims, and Rows Removed by Filter is absent. Execution is 0.050 ms against 5000 cached packages in the repository. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_packages.namespace_id AS "maven_remote_packages.namespace_id",
     maven_remote_packages.id AS "maven_remote_packages.id",
     maven_remote_packages.maven_remote_repository_id AS "maven_remote_packages.maven_remote_repository_id",
     maven_remote_packages.last_downloaded_at AS "maven_remote_packages.last_downloaded_at",
     maven_remote_packages.soft_deleted_at AS "maven_remote_packages.soft_deleted_at",
     maven_remote_packages.group_id AS "maven_remote_packages.group_id",
     maven_remote_packages.artifact_id AS "maven_remote_packages.artifact_id"
FROM public.maven_remote_packages
WHERE (((maven_remote_packages.namespace_id = $1::uuid) AND (maven_remote_packages.id = $2::uuid)) AND (maven_remote_packages.maven_remote_repository_id = $3::uuid)) AND (maven_remote_packages.soft_deleted_at IS NULL)
LIMIT $4;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, ff2ff0d1-d723-498e-89b1-bbc49c91de3f, 69b3e130-1e77-4abf-a9ed-97e3276658f1, 1]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..8.30 rows=1 width=99) (actual time=0.027..0.027 rows=1 loops=1)
  Buffers: shared hit=3
  ->  Index Scan using maven_remote_packages_p57_pkey on maven_remote_packages_p57 maven_remote_packages  (cost=0.28..8.30 rows=1 width=99) (actual time=0.026..0.026 rows=1 loops=1)
        Index Cond: ((id = 'ff2ff0d1-d723-498e-89b1-bbc49c91de3f'::uuid) AND (namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid))
        Filter: ((soft_deleted_at IS NULL) AND (maven_remote_repository_id = '69b3e130-1e77-4abf-a9ed-97e3276658f1'::uuid))
        Buffers: shared hit=3
Planning:
  Buffers: shared hit=1
Planning Time: 0.200 ms
Execution Time: 0.050 ms

Timings: planning 0.200ms, execution 0.050ms, total 0.25ms.

MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.CreatedAt_Asc_CursorNil

Summary: Plan matches the method's intent: a Limit over a forward scan of index_maven_remote_versions_on_ns_id_pkg_id_created_at_id, with namespace_id pruning to 1 of 64 partitions. The sort order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.068 ms against 5000 cached versions under the target package. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_versions.namespace_id AS "maven_remote_versions.namespace_id",
     maven_remote_versions.id AS "maven_remote_versions.id",
     maven_remote_versions.maven_remote_package_id AS "maven_remote_versions.maven_remote_package_id",
     maven_remote_versions.size_bytes AS "maven_remote_versions.size_bytes",
     maven_remote_versions.last_downloaded_at AS "maven_remote_versions.last_downloaded_at",
     maven_remote_versions.soft_deleted_at AS "maven_remote_versions.soft_deleted_at",
     maven_remote_versions.created_at AS "maven_remote_versions.created_at",
     maven_remote_versions.version AS "maven_remote_versions.version"
FROM public.maven_remote_versions
WHERE ((maven_remote_versions.namespace_id = $1::uuid) AND (maven_remote_versions.maven_remote_package_id = $2::uuid)) AND (maven_remote_versions.soft_deleted_at IS NULL)
ORDER BY maven_remote_versions.created_at ASC, maven_remote_versions.id ASC
LIMIT $3;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, ff2ff0d1-d723-498e-89b1-bbc49c91de3f, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..10.09 rows=101 width=88) (actual time=0.014..0.042 rows=101 loops=1)
  Buffers: shared hit=5
  ->  Index Scan using maven_remote_versions_p57_namespace_id_maven_remote_packag_idx4 on maven_remote_versions_p57 maven_remote_versions  (cost=0.28..485.66 rows=5000 width=88) (actual time=0.014..0.033 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_package_id = 'ff2ff0d1-d723-498e-89b1-bbc49c91de3f'::uuid))
        Buffers: shared hit=5
Planning:
  Buffers: shared hit=614
Planning Time: 3.221 ms
Execution Time: 0.068 ms

Timings: planning 3.221ms, execution 0.068ms, total 3.289ms.

MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.CreatedAt_Asc_CursorSet

Summary: Plan matches the method's intent: a Limit over a forward scan of index_maven_remote_versions_on_ns_id_pkg_id_created_at_id, with namespace_id pruning to 1 of 64 partitions. The (created_at, id) row-value bound folds into the Index Cond rather than re-checking as a post-scan Filter, and the sort order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.088 ms against 5000 cached versions under the target package. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_versions.namespace_id AS "maven_remote_versions.namespace_id",
     maven_remote_versions.id AS "maven_remote_versions.id",
     maven_remote_versions.maven_remote_package_id AS "maven_remote_versions.maven_remote_package_id",
     maven_remote_versions.size_bytes AS "maven_remote_versions.size_bytes",
     maven_remote_versions.last_downloaded_at AS "maven_remote_versions.last_downloaded_at",
     maven_remote_versions.soft_deleted_at AS "maven_remote_versions.soft_deleted_at",
     maven_remote_versions.created_at AS "maven_remote_versions.created_at",
     maven_remote_versions.version AS "maven_remote_versions.version"
FROM public.maven_remote_versions
WHERE (((maven_remote_versions.namespace_id = $1::uuid) AND (maven_remote_versions.maven_remote_package_id = $2::uuid)) AND (maven_remote_versions.soft_deleted_at IS NULL)) AND ((maven_remote_versions.created_at, maven_remote_versions.id) > ($3::timestamp with time zone, $4::uuid))
ORDER BY maven_remote_versions.created_at ASC, maven_remote_versions.id ASC
LIMIT $5;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, ff2ff0d1-d723-498e-89b1-bbc49c91de3f, 2026-01-02 17:40:00+00, b1368e7a-9fa1-4cf4-b40b-596094dacf85, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..16.06 rows=101 width=88) (actual time=0.020..0.038 rows=101 loops=1)
  Buffers: shared hit=5
  ->  Index Scan using maven_remote_versions_p57_namespace_id_maven_remote_packag_idx4 on maven_remote_versions_p57 maven_remote_versions  (cost=0.28..279.34 rows=1786 width=88) (actual time=0.019..0.030 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_package_id = 'ff2ff0d1-d723-498e-89b1-bbc49c91de3f'::uuid) AND (ROW(created_at, id) > ROW('2026-01-02 17:40:00+00'::timestamp with time zone, 'b1368e7a-9fa1-4cf4-b40b-596094dacf85'::uuid)))
        Buffers: shared hit=5
Planning:
  Buffers: shared hit=10
Planning Time: 0.272 ms
Execution Time: 0.088 ms

Timings: planning 0.272ms, execution 0.088ms, total 0.36ms.

MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.CreatedAt_Desc_CursorNil

Summary: Plan matches the method's intent: a Limit over a backward scan of index_maven_remote_versions_on_ns_id_pkg_id_created_at_id, with namespace_id pruning to 1 of 64 partitions. The sort order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.066 ms against 5000 cached versions under the target package. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_versions.namespace_id AS "maven_remote_versions.namespace_id",
     maven_remote_versions.id AS "maven_remote_versions.id",
     maven_remote_versions.maven_remote_package_id AS "maven_remote_versions.maven_remote_package_id",
     maven_remote_versions.size_bytes AS "maven_remote_versions.size_bytes",
     maven_remote_versions.last_downloaded_at AS "maven_remote_versions.last_downloaded_at",
     maven_remote_versions.soft_deleted_at AS "maven_remote_versions.soft_deleted_at",
     maven_remote_versions.created_at AS "maven_remote_versions.created_at",
     maven_remote_versions.version AS "maven_remote_versions.version"
FROM public.maven_remote_versions
WHERE ((maven_remote_versions.namespace_id = $1::uuid) AND (maven_remote_versions.maven_remote_package_id = $2::uuid)) AND (maven_remote_versions.soft_deleted_at IS NULL)
ORDER BY maven_remote_versions.created_at DESC, maven_remote_versions.id DESC
LIMIT $3;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, ff2ff0d1-d723-498e-89b1-bbc49c91de3f, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..10.09 rows=101 width=88) (actual time=0.019..0.044 rows=101 loops=1)
  Buffers: shared hit=6
  ->  Index Scan Backward using maven_remote_versions_p57_namespace_id_maven_remote_packag_idx4 on maven_remote_versions_p57 maven_remote_versions  (cost=0.28..485.66 rows=5000 width=88) (actual time=0.019..0.036 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_package_id = 'ff2ff0d1-d723-498e-89b1-bbc49c91de3f'::uuid))
        Buffers: shared hit=6
Planning:
  Buffers: shared hit=1
Planning Time: 0.213 ms
Execution Time: 0.066 ms

Timings: planning 0.213ms, execution 0.066ms, total 0.279ms.

MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.CreatedAt_Desc_CursorSet

Summary: Plan matches the method's intent: a Limit over a backward scan of index_maven_remote_versions_on_ns_id_pkg_id_created_at_id, with namespace_id pruning to 1 of 64 partitions. The (created_at, id) row-value bound folds into the Index Cond rather than re-checking as a post-scan Filter, and the sort order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.056 ms against 5000 cached versions under the target package. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_versions.namespace_id AS "maven_remote_versions.namespace_id",
     maven_remote_versions.id AS "maven_remote_versions.id",
     maven_remote_versions.maven_remote_package_id AS "maven_remote_versions.maven_remote_package_id",
     maven_remote_versions.size_bytes AS "maven_remote_versions.size_bytes",
     maven_remote_versions.last_downloaded_at AS "maven_remote_versions.last_downloaded_at",
     maven_remote_versions.soft_deleted_at AS "maven_remote_versions.soft_deleted_at",
     maven_remote_versions.created_at AS "maven_remote_versions.created_at",
     maven_remote_versions.version AS "maven_remote_versions.version"
FROM public.maven_remote_versions
WHERE (((maven_remote_versions.namespace_id = $1::uuid) AND (maven_remote_versions.maven_remote_package_id = $2::uuid)) AND (maven_remote_versions.soft_deleted_at IS NULL)) AND ((maven_remote_versions.created_at, maven_remote_versions.id) < ($3::timestamp with time zone, $4::uuid))
ORDER BY maven_remote_versions.created_at DESC, maven_remote_versions.id DESC
LIMIT $5;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, ff2ff0d1-d723-498e-89b1-bbc49c91de3f, 2026-01-02 17:40:00+00, b1368e7a-9fa1-4cf4-b40b-596094dacf85, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..12.12 rows=101 width=88) (actual time=0.011..0.031 rows=101 loops=1)
  Buffers: shared hit=6
  ->  Index Scan Backward using maven_remote_versions_p57_namespace_id_maven_remote_packag_idx4 on maven_remote_versions_p57 maven_remote_versions  (cost=0.28..377.01 rows=3213 width=88) (actual time=0.011..0.024 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_package_id = 'ff2ff0d1-d723-498e-89b1-bbc49c91de3f'::uuid) AND (ROW(created_at, id) < ROW('2026-01-02 17:40:00+00'::timestamp with time zone, 'b1368e7a-9fa1-4cf4-b40b-596094dacf85'::uuid)))
        Buffers: shared hit=6
Planning:
  Buffers: shared hit=10
Planning Time: 0.253 ms
Execution Time: 0.056 ms

Timings: planning 0.253ms, execution 0.056ms, total 0.309ms.

MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.Version_Asc_CursorNil

Summary: Plan matches the method's intent: a Limit over a forward scan of unique_maven_remote_versions_ns_id_pkg_id_version, with namespace_id pruning to 1 of 64 partitions. The sort order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.048 ms against 5000 cached versions under the target package. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_versions.namespace_id AS "maven_remote_versions.namespace_id",
     maven_remote_versions.id AS "maven_remote_versions.id",
     maven_remote_versions.maven_remote_package_id AS "maven_remote_versions.maven_remote_package_id",
     maven_remote_versions.size_bytes AS "maven_remote_versions.size_bytes",
     maven_remote_versions.last_downloaded_at AS "maven_remote_versions.last_downloaded_at",
     maven_remote_versions.soft_deleted_at AS "maven_remote_versions.soft_deleted_at",
     maven_remote_versions.created_at AS "maven_remote_versions.created_at",
     maven_remote_versions.version AS "maven_remote_versions.version"
FROM public.maven_remote_versions
WHERE ((maven_remote_versions.namespace_id = $1::uuid) AND (maven_remote_versions.maven_remote_package_id = $2::uuid)) AND (maven_remote_versions.soft_deleted_at IS NULL)
ORDER BY maven_remote_versions.version ASC
LIMIT $3;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, ff2ff0d1-d723-498e-89b1-bbc49c91de3f, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..9.20 rows=101 width=88) (actual time=0.013..0.031 rows=101 loops=1)
  Buffers: shared hit=5
  ->  Index Scan using maven_remote_versions_p57_namespace_id_maven_remote_package_idx on maven_remote_versions_p57 maven_remote_versions  (cost=0.28..441.66 rows=5000 width=88) (actual time=0.012..0.025 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_package_id = 'ff2ff0d1-d723-498e-89b1-bbc49c91de3f'::uuid))
        Buffers: shared hit=5
Planning:
  Buffers: shared hit=1
Planning Time: 0.127 ms
Execution Time: 0.048 ms

Timings: planning 0.127ms, execution 0.048ms, total 0.175ms.

MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.Version_Asc_CursorSet

Summary: Plan matches the method's intent: a Limit over a forward scan of unique_maven_remote_versions_ns_id_pkg_id_version, with namespace_id pruning to 1 of 64 partitions. The version bound folds into the Index Cond rather than re-checking as a post-scan Filter, and the sort order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.047 ms against 5000 cached versions under the target package. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_versions.namespace_id AS "maven_remote_versions.namespace_id",
     maven_remote_versions.id AS "maven_remote_versions.id",
     maven_remote_versions.maven_remote_package_id AS "maven_remote_versions.maven_remote_package_id",
     maven_remote_versions.size_bytes AS "maven_remote_versions.size_bytes",
     maven_remote_versions.last_downloaded_at AS "maven_remote_versions.last_downloaded_at",
     maven_remote_versions.soft_deleted_at AS "maven_remote_versions.soft_deleted_at",
     maven_remote_versions.created_at AS "maven_remote_versions.created_at",
     maven_remote_versions.version AS "maven_remote_versions.version"
FROM public.maven_remote_versions
WHERE (((maven_remote_versions.namespace_id = $1::uuid) AND (maven_remote_versions.maven_remote_package_id = $2::uuid)) AND (maven_remote_versions.soft_deleted_at IS NULL)) AND (maven_remote_versions.version > $3::text)
ORDER BY maven_remote_versions.version ASC
LIMIT $4;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, ff2ff0d1-d723-498e-89b1-bbc49c91de3f, v002500, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..15.37 rows=101 width=88) (actual time=0.015..0.031 rows=101 loops=1)
  Buffers: shared hit=5
  ->  Index Scan using maven_remote_versions_p57_namespace_id_maven_remote_package_idx on maven_remote_versions_p57 maven_remote_versions  (cost=0.28..262.02 rows=1752 width=88) (actual time=0.014..0.024 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_package_id = 'ff2ff0d1-d723-498e-89b1-bbc49c91de3f'::uuid) AND (version > 'v002500'::text))
        Buffers: shared hit=5
Planning:
  Buffers: shared hit=1
Planning Time: 0.146 ms
Execution Time: 0.047 ms

Timings: planning 0.146ms, execution 0.047ms, total 0.193ms.

MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.Version_Desc_CursorNil

Summary: Plan matches the method's intent: a Limit over a backward scan of unique_maven_remote_versions_ns_id_pkg_id_version, with namespace_id pruning to 1 of 64 partitions. The sort order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.049 ms against 5000 cached versions under the target package. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_versions.namespace_id AS "maven_remote_versions.namespace_id",
     maven_remote_versions.id AS "maven_remote_versions.id",
     maven_remote_versions.maven_remote_package_id AS "maven_remote_versions.maven_remote_package_id",
     maven_remote_versions.size_bytes AS "maven_remote_versions.size_bytes",
     maven_remote_versions.last_downloaded_at AS "maven_remote_versions.last_downloaded_at",
     maven_remote_versions.soft_deleted_at AS "maven_remote_versions.soft_deleted_at",
     maven_remote_versions.created_at AS "maven_remote_versions.created_at",
     maven_remote_versions.version AS "maven_remote_versions.version"
FROM public.maven_remote_versions
WHERE ((maven_remote_versions.namespace_id = $1::uuid) AND (maven_remote_versions.maven_remote_package_id = $2::uuid)) AND (maven_remote_versions.soft_deleted_at IS NULL)
ORDER BY maven_remote_versions.version DESC
LIMIT $3;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, ff2ff0d1-d723-498e-89b1-bbc49c91de3f, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..9.20 rows=101 width=88) (actual time=0.013..0.027 rows=101 loops=1)
  Buffers: shared hit=4
  ->  Index Scan Backward using maven_remote_versions_p57_namespace_id_maven_remote_package_idx on maven_remote_versions_p57 maven_remote_versions  (cost=0.28..441.66 rows=5000 width=88) (actual time=0.013..0.021 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_package_id = 'ff2ff0d1-d723-498e-89b1-bbc49c91de3f'::uuid))
        Buffers: shared hit=4
Planning:
  Buffers: shared hit=1
Planning Time: 0.130 ms
Execution Time: 0.049 ms

Timings: planning 0.130ms, execution 0.049ms, total 0.179ms.

MavenRemoteVersionStore.ListMavenRemoteVersionsByPackage.Version_Desc_CursorSet

Summary: Plan matches the method's intent: a Limit over a backward scan of unique_maven_remote_versions_ns_id_pkg_id_version, with namespace_id pruning to 1 of 64 partitions. The version bound folds into the Index Cond rather than re-checking as a post-scan Filter, and the sort order comes from the index, so no Sort node appears. Estimate and actual agree exactly (101 / 101) and execution is 0.043 ms against 5000 cached versions under the target package. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_versions.namespace_id AS "maven_remote_versions.namespace_id",
     maven_remote_versions.id AS "maven_remote_versions.id",
     maven_remote_versions.maven_remote_package_id AS "maven_remote_versions.maven_remote_package_id",
     maven_remote_versions.size_bytes AS "maven_remote_versions.size_bytes",
     maven_remote_versions.last_downloaded_at AS "maven_remote_versions.last_downloaded_at",
     maven_remote_versions.soft_deleted_at AS "maven_remote_versions.soft_deleted_at",
     maven_remote_versions.created_at AS "maven_remote_versions.created_at",
     maven_remote_versions.version AS "maven_remote_versions.version"
FROM public.maven_remote_versions
WHERE (((maven_remote_versions.namespace_id = $1::uuid) AND (maven_remote_versions.maven_remote_package_id = $2::uuid)) AND (maven_remote_versions.soft_deleted_at IS NULL)) AND (maven_remote_versions.version < $3::text)
ORDER BY maven_remote_versions.version DESC
LIMIT $4;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, ff2ff0d1-d723-498e-89b1-bbc49c91de3f, v002500, 101]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..11.17 rows=101 width=88) (actual time=0.011..0.029 rows=101 loops=1)
  Buffers: shared hit=6
  ->  Index Scan Backward using maven_remote_versions_p57_namespace_id_maven_remote_package_idx on maven_remote_versions_p57 maven_remote_versions  (cost=0.28..350.34 rows=3247 width=88) (actual time=0.010..0.023 rows=101 loops=1)
        Index Cond: ((namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid) AND (maven_remote_package_id = 'ff2ff0d1-d723-498e-89b1-bbc49c91de3f'::uuid) AND (version < 'v002500'::text))
        Buffers: shared hit=6
Planning:
  Buffers: shared hit=1
Planning Time: 0.137 ms
Execution Time: 0.043 ms

Timings: planning 0.137ms, execution 0.043ms, total 0.18ms.

MavenRemoteVersionStore.FindMavenRemoteVersionByID.VersionLeg

Summary: Plan matches the method's intent for the first of the finder's two statements: a one-row seek on unique_maven_remote_versions_id_pkg_id_ns_id, pruning to 1 of 64 partitions, with soft_deleted_at as a heap filter on the seeked row and no Rows Removed by Filter. No join node appears, which is the two-statement chain's whole point. Execution is 0.030 ms. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_versions.namespace_id AS "maven_remote_versions.namespace_id",
     maven_remote_versions.id AS "maven_remote_versions.id",
     maven_remote_versions.maven_remote_package_id AS "maven_remote_versions.maven_remote_package_id",
     maven_remote_versions.size_bytes AS "maven_remote_versions.size_bytes",
     maven_remote_versions.last_downloaded_at AS "maven_remote_versions.last_downloaded_at",
     maven_remote_versions.soft_deleted_at AS "maven_remote_versions.soft_deleted_at",
     maven_remote_versions.created_at AS "maven_remote_versions.created_at",
     maven_remote_versions.version AS "maven_remote_versions.version"
FROM public.maven_remote_versions
WHERE ((maven_remote_versions.namespace_id = $1::uuid) AND (maven_remote_versions.id = $2::uuid)) AND (maven_remote_versions.soft_deleted_at IS NULL)
LIMIT $3;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, b1368e7a-9fa1-4cf4-b40b-596094dacf85, 1]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..8.30 rows=1 width=88) (actual time=0.019..0.019 rows=1 loops=1)
  Buffers: shared hit=3
  ->  Index Scan using maven_remote_versions_p57_id_maven_remote_package_id_namesp_idx on maven_remote_versions_p57 maven_remote_versions  (cost=0.28..8.30 rows=1 width=88) (actual time=0.019..0.019 rows=1 loops=1)
        Index Cond: ((id = 'b1368e7a-9fa1-4cf4-b40b-596094dacf85'::uuid) AND (namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid))
        Filter: (soft_deleted_at IS NULL)
        Buffers: shared hit=3
Planning:
  Buffers: shared hit=1
Planning Time: 0.094 ms
Execution Time: 0.030 ms

Timings: planning 0.094ms, execution 0.030ms, total 0.124ms.

MavenRemoteVersionStore.FindMavenRemoteVersionByID.ParentPackageLeg

Summary: Plan matches the method's intent for the finder's parent leg: the same one-row seek on pk_maven_remote_packages (id, namespace_id) the package detail read uses, pruning to 1 of 64 partitions, projecting id alone. maven_remote_repository_id and soft_deleted_at are heap filters on the seeked row with no Rows Removed by Filter. Execution is 0.021 ms. No anomalies.

Seed shape: namespaces=1, repositories=2, maven_remote_repositories=2, maven_remote_packages=7000 (5000 under the target remote repository, 2000 under a sibling), maven_remote_versions=7000 (5000 under the target cached package, 2000 under a sibling)

Rendered SQL:

SELECT maven_remote_packages.id AS "maven_remote_packages.id"
FROM public.maven_remote_packages
WHERE (((maven_remote_packages.namespace_id = $1::uuid) AND (maven_remote_packages.id = $2::uuid)) AND (maven_remote_packages.maven_remote_repository_id = $3::uuid)) AND (maven_remote_packages.soft_deleted_at IS NULL)
LIMIT $4;

Bound args: [bcd439d4-b732-42b1-bd58-6b3dd1d6867b, ff2ff0d1-d723-498e-89b1-bbc49c91de3f, 69b3e130-1e77-4abf-a9ed-97e3276658f1, 1]

Plan (EXPLAIN (ANALYZE, BUFFERS) output):

Limit  (cost=0.28..8.30 rows=1 width=16) (actual time=0.012..0.012 rows=1 loops=1)
  Buffers: shared hit=3
  ->  Index Scan using maven_remote_packages_p57_pkey on maven_remote_packages_p57 maven_remote_packages  (cost=0.28..8.30 rows=1 width=16) (actual time=0.012..0.012 rows=1 loops=1)
        Index Cond: ((id = 'ff2ff0d1-d723-498e-89b1-bbc49c91de3f'::uuid) AND (namespace_id = 'bcd439d4-b732-42b1-bd58-6b3dd1d6867b'::uuid))
        Filter: ((soft_deleted_at IS NULL) AND (maven_remote_repository_id = '69b3e130-1e77-4abf-a9ed-97e3276658f1'::uuid))
        Buffers: shared hit=3
Planning:
  Buffers: shared hit=1
Planning Time: 0.082 ms
Execution Time: 0.021 ms

Timings: planning 0.082ms, execution 0.021ms, total 0.103ms.

Related to #314

Edited by Hayley Swimelar

Merge request reports

Loading
Loading