# 94 rows against 50,094 rows: plans, index sizes, latency (PostgreSQL 16, pgvector 0.8.7, 2 vCPU)

filler rows inserted: 50000 in 7819 ms. HNSW index built in 94632 ms, GIN index in 292 ms.
rows in hybrid_scale: 50094
heap 98 MB, HNSW index 98 MB, GIN index 2248 kB

--- plan for the vector query at 50,094 rows (scan nodes only) ---
Limit (actual rows=20 loops=1)
  ->  Index Scan using hybrid_scale_embedding_idx on hybrid_scale (actual rows=20 loops=1)

--- plan for the keyword query at 50,094 rows (scan nodes only) ---
Limit (actual rows=20 loops=1)
  ->  Sort (actual rows=20 loops=1)
        Sort Key: (ts_rank_cd(d.tsv, '''get'' | ''e'' | ''-4116'''::tsquery)) DESC
        Sort Method: quicksort  Memory: 26kB
        ->  Bitmap Heap Scan on hybrid_scale d (actual rows=40 loops=1)
              ->  Bitmap Index Scan on hybrid_scale_tsv_idx (actual rows=40 loops=1)

--- plan for the same keyword query at 94 rows ---
Limit (actual rows=20 loops=1)
  ->  Sort (actual rows=20 loops=1)
        Sort Key: (ts_rank_cd(d.tsv, '''get'' | ''e'' | ''-4116'''::tsquery)) DESC
        Sort Method: quicksort  Memory: 26kB
        ->  Seq Scan on hybrid_docs d (actual rows=40 loops=1)
              Rows Removed by Filter: 54

--- rows the keyword query has to rank, by query kind (50,094 rows) ---
exact error code         average rows matching the OR query:     1547
exact SKU or setting     average rows matching the OR query:     1970
paraphrase               average rows matching the OR query:     3781
code plus words          average rows matching the OR query:     5220

--- latency in milliseconds over 60 queries x 3 runs after 2 warm-up passes (query embedding excluded unless stated) ---
                                      94 p50    94 p95   50k p50   50k p95
embedding the question (MiniLM)          7.4      10.4   (same for both table sizes)
vector, top 20                          25.3      32.2      28.0      36.4
keyword, top 20                         27.0      39.3      85.5     177.1
hybrid in Java (2 queries + fuse)       51.6      65.3     111.2     208.2
hybrid in one SQL statement             31.5      40.1     132.3     226.4

--- keyword query latency at 50,094 rows by query kind (p50 / p95 ms) ---
exact error code            51.1 /   124.0
exact SKU or setting        35.7 /   223.0
paraphrase                  85.9 /   169.6
code plus words            121.2 /   214.9
