Optimize exact pipeline name queries

What does this MR do and why?

Exact-name pipeline requests can spend most of their time scanning a project's pipeline history or combining a large metadata project index with the name index. This optimizes the shared finder already used by GET /projects/:id/pipelines?name=.

The metadata-first lookup is guarded by the project-scoped pipeline_name_filter flag, shared with !261346 (merged). The flag is disabled by default. Disabling it restores the existing name lookup; REST requests continue to filter by name. This MR owns the flag definition; !261346 (merged) drops its copy once this merges.

  • Match metadata first, then perform one bounded pipeline lookup by ID and partition for each candidate.
  • Keep the metadata project condition as project_id + 0 so the planner can use the name index without the expensive project-index BitmapAnd.
  • Keep Branches and Tags on the original query; the metadata lookup is not eligible for them, latest-per-ref selection is unchanged.
  • Preserve project/user isolation, filters, ordering, cursor conditions, bounded counts, and REST pagination totals.

The model and finder specs travel with the optimization. A REST regression checks matching names across partitions, excludes another project's matching pipeline, and verifies IDs and totals on both pages.

Database review

Revision Full SQL Local EXPLAIN ANALYZE and correctness evidence
Before, b00391b1ec34 Before SQL Before local plans
After, 50562975a870 After SQL After local plans

Parameters and rerun instructions. Each pack contains 12 actual REST scenarios with 24 page/count statements, plus two separately labelled finder counts with limit 1000. REST pagination uses a count limit of 10,000, producing SQL LIMIT 10001. Both revisions returned the expected IDs and pagination headers in the capture.

Production review and remaining validation

The originating Database Lab review found common-name GraphQL counts taking 407 ms warm and 7.2 s cold, and up to 41.7 s cold with a high-history bot. It recommended project_id + 0 and measured an improvement for that query variant. Those historical measurements motivate this change; they do not approve this final revision or its REST count limit.

The attached plans use tiny local transactional fixtures. Repeat old and new SQL on the same production CI snapshot, cold and warm, with rare/common/missing names, a name common in other projects, regular/bot users, selective filters, pagination, and complete Branches/Tags ref lists. Verify project isolation, partition pruning, buffers, and index choice. Name plus selective-filter API counts can still be expensive. The UI's decision to skip its combined-filter badge count is tracked in !262417 (merged).

The database reviewer has compared the before/after REST SQL on a production CI snapshot. The optimized query is unchanged when the flag is enabled. The warm name-plus-bot count improved from 5.8 s to 288 ms, while the regular-user count increased from 62 ms to 591 ms and the source-filter count from 54 ms to 325 ms. Cold counts and names common in other projects remain expensive.

Pipeline Execution still needs to accept this trade-off and confirm a rollout DRI in #633306. Keep the flag disabled until the required reviews and rollout checks are complete. Final database approval and merged-results CI on current master remain pending. Pipeline 2963736236 passed for 6d38d1b1ee26 with a non-blocking warning.

Local validation for this revision: 266 finder/REST examples and eight model examples, zero failures, two existing pending examples. New tests failed before the guard was added: both a disabled flag and a flag enabled for another project still selected the metadata lookup. Coverage includes enabled and disabled REST pagination across partitions. The prior before/after SQL captures remain applicable to the enabled query.

Captured SQL before and after

The complete statements are included below. Each statement links to its corresponding EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) in the local evidence file, identified by its JSON path. The fixtures contain 44 pipelines, including 38 in the target project across two partitions. These plans verify execution and results only. They do not establish production performance.

Each revision has 24 REST statements from 12 requests and two supplementary direct-finder counts. The latter are not captured GraphQL requests. The no-name baseline is unchanged. The missing-name case intentionally returns no rows and is a correctness check.

The SQL uses psql variables: :project_id and :user_id are numeric; :'pipeline_name', :'missing_pipeline_name', and :'ref_N' are quoted text variables. Set them from the same Database Lab snapshot for both revisions. For Branches/Tags, replace the entire captured VALUES list with the complete ref list from the target project. The parameter guide and rerun instructions apply to every statement.

No-name baseline: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.no_name.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.no_name.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.no_name.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.no_name.statements[1].local_synthetic_plan.

Exact name: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_only.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_only.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_only.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_only.statements[1].local_synthetic_plan.

Name and username: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_username.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_username.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_username.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_username.statements[1].local_synthetic_plan.

Name, username, ref, status, and source: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" = 'success'
AND "p_ci_pipelines"."ref" = :'ref_53'
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."source" = 2
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_all_filters.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" = 'success'
AND "p_ci_pipelines"."ref" = :'ref_53'
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."source" = 2
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_all_filters.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" = 'success'
AND "p_ci_pipelines"."ref" = :'ref_53'
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."source" = 2
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_all_filters.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" = 'success'
AND "p_ci_pipelines"."ref" = :'ref_53'
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."source" = 2
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_all_filters.statements[1].local_synthetic_plan.

Name and ref: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."ref" = :'ref_53'
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_ref.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."ref" = :'ref_53'
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_ref.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."ref" = :'ref_53'
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_ref.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."ref" = :'ref_53'
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_ref.statements[1].local_synthetic_plan.

Name and status: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" = 'failed'
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_status.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" = 'failed'
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_status.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" = 'failed'
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_status.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" = 'failed'
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_status.statements[1].local_synthetic_plan.

Name and source: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."source" = 4
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_source.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."source" = 4
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_source.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."source" = 4
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_source.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."source" = 4
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_source.statements[1].local_synthetic_plan.

Name and Finished scope: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" IN ('success', 'failed', 'canceled')
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_finished.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" IN ('success', 'failed', 'canceled')
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_finished.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" IN ('success', 'failed', 'canceled')
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_finished.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" IN ('success', 'failed', 'canceled')
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_finished.statements[1].local_synthetic_plan.

Name and Branches scope: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (VALUES (:'ref_1'), (:'ref_2'), (:'ref_3'), (:'ref_4'), (:'ref_5'), (:'ref_6'), (:'ref_7'), (:'ref_8'), (:'ref_9'), (:'ref_10'), (:'ref_11'), (:'ref_12'), (:'ref_13'), (:'ref_14'), (:'ref_15'), (:'ref_16'), (:'ref_17'), (:'ref_18'), (:'ref_19'), (:'ref_20'), (:'ref_21'), (:'ref_22'), (:'ref_23'), (:'ref_24'), (:'ref_25'), (:'ref_26'), (:'ref_27'), (:'ref_28'), (:'ref_29'), (:'ref_30'), (:'ref_31'), (:'ref_32'), (:'ref_33'), (:'ref_34'), (:'ref_35'), (:'ref_36'), (:'ref_37'), (:'ref_38'), (:'ref_39'), (:'ref_40'), (:'ref_41'), (:'ref_42'), (:'ref_43'), (:'ref_44'), (:'ref_45'), (:'ref_46'), (:'ref_47'), (:'ref_48'), (:'ref_49'), (:'ref_50'), (:'ref_51'), (:'ref_52'), (:'ref_53'), (:'ref_54'), (:'ref_55'), (:'ref_56'), (:'ref_57'), (:'ref_58'), (:'ref_59'), (:'ref_60'), (:'ref_61'), (:'ref_62'), (:'ref_63'), (:'ref_64'), (:'ref_65'), (:'ref_66'), (:'ref_67'), (:'ref_68'), (:'ref_69'), (:'ref_70'), (:'ref_71'), (:'ref_72'), (:'ref_73'), (:'ref_74'), (:'ref_75'), (:'ref_76'), (:'ref_77'), (:'ref_78'), (:'ref_79'), (:'ref_80'), (:'ref_81'), (:'ref_82'), (:'ref_83'), (:'ref_84'), (:'ref_85'), (:'ref_86'), (:'ref_87'), (:'ref_88'), (:'ref_89'), (:'ref_90')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = FALSE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_branches.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (VALUES (:'ref_1'), (:'ref_2'), (:'ref_3'), (:'ref_4'), (:'ref_5'), (:'ref_6'), (:'ref_7'), (:'ref_8'), (:'ref_9'), (:'ref_10'), (:'ref_11'), (:'ref_12'), (:'ref_13'), (:'ref_14'), (:'ref_15'), (:'ref_16'), (:'ref_17'), (:'ref_18'), (:'ref_19'), (:'ref_20'), (:'ref_21'), (:'ref_22'), (:'ref_23'), (:'ref_24'), (:'ref_25'), (:'ref_26'), (:'ref_27'), (:'ref_28'), (:'ref_29'), (:'ref_30'), (:'ref_31'), (:'ref_32'), (:'ref_33'), (:'ref_34'), (:'ref_35'), (:'ref_36'), (:'ref_37'), (:'ref_38'), (:'ref_39'), (:'ref_40'), (:'ref_41'), (:'ref_42'), (:'ref_43'), (:'ref_44'), (:'ref_45'), (:'ref_46'), (:'ref_47'), (:'ref_48'), (:'ref_49'), (:'ref_50'), (:'ref_51'), (:'ref_52'), (:'ref_53'), (:'ref_54'), (:'ref_55'), (:'ref_56'), (:'ref_57'), (:'ref_58'), (:'ref_59'), (:'ref_60'), (:'ref_61'), (:'ref_62'), (:'ref_63'), (:'ref_64'), (:'ref_65'), (:'ref_66'), (:'ref_67'), (:'ref_68'), (:'ref_69'), (:'ref_70'), (:'ref_71'), (:'ref_72'), (:'ref_73'), (:'ref_74'), (:'ref_75'), (:'ref_76'), (:'ref_77'), (:'ref_78'), (:'ref_79'), (:'ref_80'), (:'ref_81'), (:'ref_82'), (:'ref_83'), (:'ref_84'), (:'ref_85'), (:'ref_86'), (:'ref_87'), (:'ref_88'), (:'ref_89'), (:'ref_90')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = FALSE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_branches.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (VALUES (:'ref_1'), (:'ref_2'), (:'ref_3'), (:'ref_4'), (:'ref_5'), (:'ref_6'), (:'ref_7'), (:'ref_8'), (:'ref_9'), (:'ref_10'), (:'ref_11'), (:'ref_12'), (:'ref_13'), (:'ref_14'), (:'ref_15'), (:'ref_16'), (:'ref_17'), (:'ref_18'), (:'ref_19'), (:'ref_20'), (:'ref_21'), (:'ref_22'), (:'ref_23'), (:'ref_24'), (:'ref_25'), (:'ref_26'), (:'ref_27'), (:'ref_28'), (:'ref_29'), (:'ref_30'), (:'ref_31'), (:'ref_32'), (:'ref_33'), (:'ref_34'), (:'ref_35'), (:'ref_36'), (:'ref_37'), (:'ref_38'), (:'ref_39'), (:'ref_40'), (:'ref_41'), (:'ref_42'), (:'ref_43'), (:'ref_44'), (:'ref_45'), (:'ref_46'), (:'ref_47'), (:'ref_48'), (:'ref_49'), (:'ref_50'), (:'ref_51'), (:'ref_52'), (:'ref_53'), (:'ref_54'), (:'ref_55'), (:'ref_56'), (:'ref_57'), (:'ref_58'), (:'ref_59'), (:'ref_60'), (:'ref_61'), (:'ref_62'), (:'ref_63'), (:'ref_64'), (:'ref_65'), (:'ref_66'), (:'ref_67'), (:'ref_68'), (:'ref_69'), (:'ref_70'), (:'ref_71'), (:'ref_72'), (:'ref_73'), (:'ref_74'), (:'ref_75'), (:'ref_76'), (:'ref_77'), (:'ref_78'), (:'ref_79'), (:'ref_80'), (:'ref_81'), (:'ref_82'), (:'ref_83'), (:'ref_84'), (:'ref_85'), (:'ref_86'), (:'ref_87'), (:'ref_88'), (:'ref_89'), (:'ref_90')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = FALSE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND "ci_pipeline_metadata"."partition_id" = "p_ci_pipelines"."partition_id"
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_branches.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (VALUES (:'ref_1'), (:'ref_2'), (:'ref_3'), (:'ref_4'), (:'ref_5'), (:'ref_6'), (:'ref_7'), (:'ref_8'), (:'ref_9'), (:'ref_10'), (:'ref_11'), (:'ref_12'), (:'ref_13'), (:'ref_14'), (:'ref_15'), (:'ref_16'), (:'ref_17'), (:'ref_18'), (:'ref_19'), (:'ref_20'), (:'ref_21'), (:'ref_22'), (:'ref_23'), (:'ref_24'), (:'ref_25'), (:'ref_26'), (:'ref_27'), (:'ref_28'), (:'ref_29'), (:'ref_30'), (:'ref_31'), (:'ref_32'), (:'ref_33'), (:'ref_34'), (:'ref_35'), (:'ref_36'), (:'ref_37'), (:'ref_38'), (:'ref_39'), (:'ref_40'), (:'ref_41'), (:'ref_42'), (:'ref_43'), (:'ref_44'), (:'ref_45'), (:'ref_46'), (:'ref_47'), (:'ref_48'), (:'ref_49'), (:'ref_50'), (:'ref_51'), (:'ref_52'), (:'ref_53'), (:'ref_54'), (:'ref_55'), (:'ref_56'), (:'ref_57'), (:'ref_58'), (:'ref_59'), (:'ref_60'), (:'ref_61'), (:'ref_62'), (:'ref_63'), (:'ref_64'), (:'ref_65'), (:'ref_66'), (:'ref_67'), (:'ref_68'), (:'ref_69'), (:'ref_70'), (:'ref_71'), (:'ref_72'), (:'ref_73'), (:'ref_74'), (:'ref_75'), (:'ref_76'), (:'ref_77'), (:'ref_78'), (:'ref_79'), (:'ref_80'), (:'ref_81'), (:'ref_82'), (:'ref_83'), (:'ref_84'), (:'ref_85'), (:'ref_86'), (:'ref_87'), (:'ref_88'), (:'ref_89'), (:'ref_90')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = FALSE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND "ci_pipeline_metadata"."partition_id" = "p_ci_pipelines"."partition_id"
ORDER BY "id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_branches.statements[1].local_synthetic_plan.

Name and Tags scope: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (VALUES (:'ref_91'), (:'ref_84'), (:'ref_92')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = TRUE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_tags.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (VALUES (:'ref_91'), (:'ref_84'), (:'ref_92')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = TRUE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_tags.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (VALUES (:'ref_91'), (:'ref_84'), (:'ref_92')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = TRUE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND "ci_pipeline_metadata"."partition_id" = "p_ci_pipelines"."partition_id"
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_tags.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (VALUES (:'ref_91'), (:'ref_84'), (:'ref_92')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = TRUE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND "ci_pipeline_metadata"."partition_id" = "p_ci_pipelines"."partition_id"
ORDER BY "id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.name_tags.statements[1].local_synthetic_plan.

Missing name (intentional zero-result correctness case): before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "ci_pipeline_metadata"."name" = :'missing_pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.missing_name.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "ci_pipeline_metadata"."name" = :'missing_pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.missing_name.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'missing_pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.missing_name.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'missing_pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 0;

Local fixture query plan, JSON path rest_scenarios.missing_name.statements[1].local_synthetic_plan.

Name and username, second offset page: before and after

Before b00391b1ec34: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_username_second_page.statements[0].local_synthetic_plan.

Before b00391b1ec34: REST page SELECT

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 16;

Local fixture query plan, JSON path rest_scenarios.name_username_second_page.statements[1].local_synthetic_plan.

After 50562975a870: REST count, limit 10,000 (SQL LIMIT 10001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 10001) subquery_for_count;

Local fixture query plan, JSON path rest_scenarios.name_username_second_page.statements[0].local_synthetic_plan.

After 50562975a870: REST page SELECT

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 16
OFFSET 16;

Local fixture query plan, JSON path rest_scenarios.name_username_second_page.statements[1].local_synthetic_plan.

Exact name, supplementary finder count: before and after

Before b00391b1ec34: Direct finder count, limit 1000 (SQL LIMIT 1001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 1001) subquery_for_count;

Local fixture query plan, JSON path supplementary_finder_counts.name_only.statements[0].local_synthetic_plan.

After 50562975a870: Direct finder count, limit 1000 (SQL LIMIT 1001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 1001) subquery_for_count;

Local fixture query plan, JSON path supplementary_finder_counts.name_only.statements[0].local_synthetic_plan.

Name and username, supplementary finder count: before and after

Before b00391b1ec34: Direct finder count, limit 1000 (SQL LIMIT 1001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
LIMIT 1001) subquery_for_count;

Local fixture query plan, JSON path supplementary_finder_counts.name_username.statements[0].local_synthetic_plan.

After 50562975a870: Direct finder count, limit 1000 (SQL LIMIT 1001)

SELECT COUNT(*)
FROM (SELECT 1 AS one
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
LIMIT 1001) subquery_for_count;

Local fixture query plan, JSON path supplementary_finder_counts.name_username.statements[0].local_synthetic_plan.

Maximum-page and alternate-order reruns (plans pending)

The captured requests used per_page=16, including a second page with OFFSET 16. The maximum page size is 100. The review variants below use LIMIT 100 OFFSET 100 (per_page=100&page=2), and one also uses order_by=updated_at&sort=desc. They are derived from the captured final REST page statements by changing only pagination and, for the last variant, ordering. They have not been executed or explained. Record before/after Database Lab plans for these variants on a dataset with enough matching rows to fill the offset and page. Do not treat an empty or undersized local page as performance evidence.

Exact name: maximum page, nonzero offset, before and after

Before b00391b1ec34

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

After 50562975a870

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

Name and username: maximum page, nonzero offset, before and after

Before b00391b1ec34

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

After 50562975a870

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

Name, username, ref, status, and source: maximum page, nonzero offset, before and after

Before b00391b1ec34

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" = 'success'
AND "p_ci_pipelines"."ref" = :'ref_53'
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."source" = 2
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

After 50562975a870

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."status" = 'success'
AND "p_ci_pipelines"."ref" = :'ref_53'
AND "p_ci_pipelines"."user_id" = :user_id
AND "p_ci_pipelines"."source" = 2
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

Name and Branches scope: maximum page, nonzero offset, before and after

Before b00391b1ec34

SELECT "p_ci_pipelines".*
FROM (VALUES (:'ref_1'), (:'ref_2'), (:'ref_3'), (:'ref_4'), (:'ref_5'), (:'ref_6'), (:'ref_7'), (:'ref_8'), (:'ref_9'), (:'ref_10'), (:'ref_11'), (:'ref_12'), (:'ref_13'), (:'ref_14'), (:'ref_15'), (:'ref_16'), (:'ref_17'), (:'ref_18'), (:'ref_19'), (:'ref_20'), (:'ref_21'), (:'ref_22'), (:'ref_23'), (:'ref_24'), (:'ref_25'), (:'ref_26'), (:'ref_27'), (:'ref_28'), (:'ref_29'), (:'ref_30'), (:'ref_31'), (:'ref_32'), (:'ref_33'), (:'ref_34'), (:'ref_35'), (:'ref_36'), (:'ref_37'), (:'ref_38'), (:'ref_39'), (:'ref_40'), (:'ref_41'), (:'ref_42'), (:'ref_43'), (:'ref_44'), (:'ref_45'), (:'ref_46'), (:'ref_47'), (:'ref_48'), (:'ref_49'), (:'ref_50'), (:'ref_51'), (:'ref_52'), (:'ref_53'), (:'ref_54'), (:'ref_55'), (:'ref_56'), (:'ref_57'), (:'ref_58'), (:'ref_59'), (:'ref_60'), (:'ref_61'), (:'ref_62'), (:'ref_63'), (:'ref_64'), (:'ref_65'), (:'ref_66'), (:'ref_67'), (:'ref_68'), (:'ref_69'), (:'ref_70'), (:'ref_71'), (:'ref_72'), (:'ref_73'), (:'ref_74'), (:'ref_75'), (:'ref_76'), (:'ref_77'), (:'ref_78'), (:'ref_79'), (:'ref_80'), (:'ref_81'), (:'ref_82'), (:'ref_83'), (:'ref_84'), (:'ref_85'), (:'ref_86'), (:'ref_87'), (:'ref_88'), (:'ref_89'), (:'ref_90')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = FALSE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "id" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

After 50562975a870

SELECT "p_ci_pipelines".*
FROM (VALUES (:'ref_1'), (:'ref_2'), (:'ref_3'), (:'ref_4'), (:'ref_5'), (:'ref_6'), (:'ref_7'), (:'ref_8'), (:'ref_9'), (:'ref_10'), (:'ref_11'), (:'ref_12'), (:'ref_13'), (:'ref_14'), (:'ref_15'), (:'ref_16'), (:'ref_17'), (:'ref_18'), (:'ref_19'), (:'ref_20'), (:'ref_21'), (:'ref_22'), (:'ref_23'), (:'ref_24'), (:'ref_25'), (:'ref_26'), (:'ref_27'), (:'ref_28'), (:'ref_29'), (:'ref_30'), (:'ref_31'), (:'ref_32'), (:'ref_33'), (:'ref_34'), (:'ref_35'), (:'ref_36'), (:'ref_37'), (:'ref_38'), (:'ref_39'), (:'ref_40'), (:'ref_41'), (:'ref_42'), (:'ref_43'), (:'ref_44'), (:'ref_45'), (:'ref_46'), (:'ref_47'), (:'ref_48'), (:'ref_49'), (:'ref_50'), (:'ref_51'), (:'ref_52'), (:'ref_53'), (:'ref_54'), (:'ref_55'), (:'ref_56'), (:'ref_57'), (:'ref_58'), (:'ref_59'), (:'ref_60'), (:'ref_61'), (:'ref_62'), (:'ref_63'), (:'ref_64'), (:'ref_65'), (:'ref_66'), (:'ref_67'), (:'ref_68'), (:'ref_69'), (:'ref_70'), (:'ref_71'), (:'ref_72'), (:'ref_73'), (:'ref_74'), (:'ref_75'), (:'ref_76'), (:'ref_77'), (:'ref_78'), (:'ref_79'), (:'ref_80'), (:'ref_81'), (:'ref_82'), (:'ref_83'), (:'ref_84'), (:'ref_85'), (:'ref_86'), (:'ref_87'), (:'ref_88'), (:'ref_89'), (:'ref_90')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = FALSE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND "ci_pipeline_metadata"."partition_id" = "p_ci_pipelines"."partition_id"
ORDER BY "id" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

Name and Tags scope: maximum page, nonzero offset, before and after

Before b00391b1ec34

SELECT "p_ci_pipelines".*
FROM (VALUES (:'ref_91'), (:'ref_84'), (:'ref_92')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = TRUE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "id" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

After 50562975a870

SELECT "p_ci_pipelines".*
FROM (VALUES (:'ref_91'), (:'ref_84'), (:'ref_92')) AS refs(ref), LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."tag" = TRUE
AND (p_ci_pipelines.ref = refs.ref)
ORDER BY "p_ci_pipelines"."id" DESC
LIMIT 1) AS p_ci_pipelines
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND "ci_pipeline_metadata"."partition_id" = "p_ci_pipelines"."partition_id"
ORDER BY "id" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

Name ordered by updated_at: maximum page, nonzero offset, before and after

Before b00391b1ec34

SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
INNER JOIN "ci_pipeline_metadata" ON "ci_pipeline_metadata"."pipeline_id" = "p_ci_pipelines"."id"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "ci_pipeline_metadata"."name" = :'pipeline_name'
ORDER BY "p_ci_pipelines"."updated_at" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

After 50562975a870

SELECT "p_ci_pipelines".*
FROM (SELECT "ci_pipeline_metadata"."pipeline_id" AS id, "p_ci_pipelines"."ref", "p_ci_pipelines"."sha", "p_ci_pipelines"."before_sha", "p_ci_pipelines"."created_at", "p_ci_pipelines"."updated_at", "p_ci_pipelines"."tag", "p_ci_pipelines"."yaml_errors", "p_ci_pipelines"."committed_at", "p_ci_pipelines"."project_id", "p_ci_pipelines"."status", "p_ci_pipelines"."started_at", "p_ci_pipelines"."finished_at", "p_ci_pipelines"."duration", "p_ci_pipelines"."user_id", "p_ci_pipelines"."lock_version", "p_ci_pipelines"."pipeline_schedule_id", "p_ci_pipelines"."source", "p_ci_pipelines"."config_source", "p_ci_pipelines"."protected", "p_ci_pipelines"."failure_reason", "p_ci_pipelines"."iid", "p_ci_pipelines"."merge_request_id", "p_ci_pipelines"."source_sha", "p_ci_pipelines"."target_sha", "p_ci_pipelines"."external_pull_request_id", "p_ci_pipelines"."ci_ref_id", "p_ci_pipelines"."locked", "p_ci_pipelines"."partition_id", "p_ci_pipelines"."auto_canceled_by_id", "p_ci_pipelines"."auto_canceled_by_partition_id", "p_ci_pipelines"."trigger_id"
FROM (SELECT "ci_pipeline_metadata"."pipeline_id", "ci_pipeline_metadata"."partition_id"
FROM "ci_pipeline_metadata"
WHERE "ci_pipeline_metadata"."name" = :'pipeline_name'
AND ("ci_pipeline_metadata"."project_id" + 0) = :project_id) ci_pipeline_metadata
INNER JOIN LATERAL (SELECT "p_ci_pipelines".*
FROM "p_ci_pipelines"
WHERE "p_ci_pipelines"."project_id" = :project_id
AND "p_ci_pipelines"."source" != 12
AND "p_ci_pipelines"."id" = "ci_pipeline_metadata"."pipeline_id"
AND "p_ci_pipelines"."partition_id" = "ci_pipeline_metadata"."partition_id"
LIMIT 1) "p_ci_pipelines"
ON TRUE) p_ci_pipelines
ORDER BY "p_ci_pipelines"."updated_at" DESC
LIMIT 100
OFFSET 100;

Database Lab query plan: pending.

References

Screenshots or screen recordings

Not applicable. This MR changes query execution only.

How to set up and validate locally

  1. Use a project with named pipelines across multiple refs, users, statuses, and partitions. Keep the same exact name in another project.
  2. In the Rails console, enable the optimized lookup for that project with Feature.enable(:pipeline_name_filter, project).
  3. Request /api/v4/projects/:id/pipelines?name=Nightly%20build&per_page=1&page=1 as a user with pipeline access. Check the project boundary, exact name, ordering, and X-Total / X-Total-Pages.
  4. Request page 2, then combine the name with username, ref, status, or source. Check the returned pipelines and pagination totals.
  5. Check scope=branches and scope=tags with an older matching pipeline and a latest non-matching pipeline on the same ref. The older pipeline must remain excluded.
  6. Disable the flag with Feature.disable(:pipeline_name_filter, project) and repeat the requests. REST name filtering and pagination must still work through the existing lookup.
  7. Review the production comparison and repeat the attached Database Lab scenarios as needed before approving rollout.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Per-shape summary (count, warm / cold)

shape master this MR (lookup) eligible?
name only 206 / 208 ms 207 / 127 ms yes
name + status=success 427 / 503 ms 170 / 175 ms yes (success only)
name + finished 271 ms / 1.4 s 134 / 126 ms yes
name + username, regular 62 ms / 1.1 s 591 / 764 ms yes (flagged trade-off, ~10 req/day)
name + username, bot 5.8 s / 2 min 288 ms / 17.8 s yes
name + source 54 / 285 ms 325 / 613 ms no (62% of name traffic)
name + ref 494 ms / 2.4 s 223 / 224 ms no (measured win, conservative first pass)
name + sha / iids / ids / schedules point lookups not measured no
name + running / pending 58 / 37 ms 179 / 172 ms no (clone measurement, note 4252445001)
Branches / Tags 48 / 31 ms warm original query no

Sources: production comparison (note 4041503208) and clone runs (note 4252451392).

Follow-up

Cover project_id in the ci_pipeline_metadata name index, drop the + 0 fence and re-measure the lookup shapes: #640784.

Edited by Aleksandr Kotlyar

Merge request reports

Loading
Loading