# Iterative-scan benchmark, case C2: 10% correlated CROSS-TENANT key + a residual predicate.
# RUN 2026-10-07 (55 min on a release Postgres; analysis in REPORT-residual-filter.md). Needs a pg_pinecone build with iterative scan + deepen-before-widen;
# see configs/README-residual.md for setup and the run command.
#
# Shape (the 2026-09 "wiki_dpr 10% correlated cross-tenant -- C2" cell): wiki_dpr 1M x 768d, same
# artifact/seed/k-means as configs/wikidpr_1m_pg_pinecone.yaml. The pg_pinecone index is built on
# (embedding, filt_correlated_0100_eq): the PUSHED key (100k rows). The residual is a second
# column the index cannot push (filt_uncorrelated_0003_eq / _0010_eq, i.e. `category = X` with a
# 0.3% / 1% pass rate, independent of the tenant key): an executor Filter, so the scan can
# return fewer than LIMIT 10 unless it iterates.
#   combined: 326 rows (10% key x 0.3%) and 1,004 rows (10% key x 1%) of 1M.
# Queries are the out_region (cross-tenant) pool only. Sweep, recorded fields and the
# mode_l_threshold note: identical to configs/residual-c1.yaml. Here max_scan_tuples 100000 is
# about the whole key set (100k rows) and 2000 is a hard cut, so the cap axis is live.
name: residual_c2
seed: 42
k: 10
warmup_queries: 20
hardness_recall_threshold: 0.97
min_throughput_seconds: 5.0

postgres:
  maintenance_work_mem: 8GB
  min_wal_size: 1GB
  max_wal_size: 4GB

dataset:
  kind: real
  artifact: wikidpr_768d_1m.npz
  n: 1000000
  dim: 768
  n_centers: 1000
  kmeans_sample: 100000
  kmeans_iters: 15
  n_queries: 500

metric: l2

filters:
  query_modes: [out_region]
  run:
    - {selectivity: 0.10, mode: correlated, residual: {selectivity: 0.003, mode: uncorrelated}}
    - {selectivity: 0.10, mode: correlated, residual: {selectivity: 0.01, mode: uncorrelated}}

systems:
  - name: pgvector_hnsw
    type: hnsw
    skip_unfiltered: true
    explain_probe: true
    build_params: {m: 16, ef_construction: 64}
    sweep_param: ef_search
    sweep_values: [40, 200]
    iterative_scan_values: ["off", "relaxed_order", "strict_order"]
    scan_budget_param: hnsw.max_scan_tuples
    filtered_scan_budget_values: [20000, 100000]

  - name: pg_pinecone_native
    type: pg_pinecone_native
    skip_unfiltered: true
    explain_probe: true
    record_scan_stats: true
    build_params: {seed: 42, mode_l_threshold: 0.005, filter_column: filt_correlated_0100_eq}
    sweep_param: rescore_multiplier
    sweep_values: [10, 50]
    iterative_scan_values: ["off", "relaxed_order", "strict_order"]
    scan_budget_param: pinecone.max_scan_tuples
    filtered_scan_budget_values: [2000, 20000, 100000]
    scan_fraction_values: [0.0, 0.5]

  # Exact reference (forced seqscan + top-N sort, recall 1.0 by construction): what an index has to beat.
  - name: exact_seqscan
    type: exact
    skip_unfiltered: true
    sweep_param: none
    sweep_values: [0]

concurrency: [1, 8]

churn:
  enabled: false

sift1m:
  enabled: false
