MySQL protocol: Based on the MSMARCO 100-million-scale dataset

Updated at:

This benchmark covers write and query performance of the PolarDB vector index on 113 million 1024-dimensional vectors using the MySQL protocol. Use the results for technology selection, capacity planning, and parameter tuning.

Scope

The results reflect a specific cluster environment and dataset. Before using this data to make decisions, confirm that your environment matches the one described here.

Cluster specifications

Component Specification
Primary node 4 cores, 16 GB
Read-only node 4 cores, 16 GB
Columnstore index read-only node 88 cores, 710 GB
Client latency 0.201 ms
Kernel version MySQL 8.0.2

Dataset

Category Subitem Details
Software version PolarDB MySQL 8.0.2
Dataset MSMARCO V2.1 Cohere/msmarco-v2.1-embed-english-v3
Data type Single-precision floating-point number (FP32)
Data size 113,520,750 vectors
Vector dimensions 1024
Query set size 1677
Algorithm parameters Distance metric INNER_PRODUCT (inner product distance)
Index type HNSW (Hierarchical Navigable Small World)

Why MSMARCO V2.1: This dataset represents large-scale semantic text retrieval — a common production workload for search and recommendation applications that embed documents with language models. Its 1024-dimensional vectors reflect the output size of models such as Cohere's embed-english-v3.

Reproduce the benchmark

Follow these steps to set up the index, write data, and run the performance test.

Create the vector index and write data

  1. Run the following Data Definition Language (DDL) statement to create the doc_embeddings table, which stores vector data and defines the vector index type and parameters.

    CREATE TABLE doc_embeddings (
        id INT(11) NOT NULL AUTO_INCREMENT,
        docid VARCHAR(45) NOT NULL,
        emb VECTOR(1024) DEFAULT NULL COMMENT 'imci_vector_index=FAISS_HNSW_SQ(metric=INNER_PRODUCT,max_degree=16,ef_construction=200,sq_type=fp16)',
        PRIMARY KEY (id)
    ) ENGINE = InnoDB COMMENT 'columnar=1'
    PARTITION BY HASH (id) PARTITIONS 8;

    Key parameters

    Parameter Description
    COMMENT 'columnar=1' Creates a columnstore index for the table. A columnstore index is required to use a vector index.
    COMMENT 'imci_vector_index=...' Defines the vector index configuration.
    FAISS_HNSW_SQ Uses the HNSW algorithm from the FAISS library, combined with scalar quantization (SQ) for compression.
    sq_type=fp16 Applies 16-bit floating-point (FP16) quantization. This halves memory and storage compared to FP32 while maintaining high precision.
    max_degree=16 Sets the maximum number of connections per node in the HNSW graph.
    ef_construction=200 Sets the dynamic neighbor list size during index building. For more information, see Create a vector index.
    PARTITION BY HASH (id) PARTITIONS 8 Distributes table and index data across 8 partitions using the auto-increment primary key. This enables multi-core parallel processing to balance query latency and throughput under high concurrency. Set the partition count based on your CPU core count, or tune it with stress test results.
  2. Write the MSMARCO V2.1 dataset to the doc_embeddings table. PolarDB automatically builds the FAISS_HNSW_SQ vector index in the background on the columnstore index read-only node.

Write performance

  • Total time: 6,296.51 seconds (approximately 1.75 hours). This includes data network transfer, writing to doc_embeddings, and background FAISS_HNSW_SQ index building.

  • Average write throughput: 18,029.15 vectors/sec.

Run the query performance test

The stress test measures query throughput (queries per second, QPS), latency, and recall rate across different combinations of concurrency and ef_search values.

  • concurrency: Simulates 1 to 128 concurrent queries.

  • ef_search: Controls the breadth of the neighbor search in the HNSW graph. A higher value increases recall but raises computational overhead, which lowers QPS and increases latency.

Stress test command

Run the following command. The script internally tests each combination of concurrency and ef_search for 60 seconds.

Note

To get the test script, submit a ticket.

python perf_test_parallel.py

Performance results

How to read the results table

The table has two axes:

  • `ef_search` (120, 160, 200): Controls the precision-performance tradeoff. Higher values increase Recall@10 at the cost of QPS and latency. Choose a row group based on your recall target.

  • Concurrency: Reflects how many queries run in parallel. Match this to your expected production load.

Which columns to focus on:

Goal Focus on
Maximize throughput (web services, batch search, high-concurrency workloads) QPS
Minimize response time (real-time applications, latency-sensitive services) Avg latency and P99 latency
Note

P95 and P99 latency are percentile-based measurements. P99 latency means 99% of queries complete within that time — it captures worst-case tail behavior better than the average. For example, "3,000 QPS at P99 latency of 20 ms" means 3,000 queries complete per second and 99% of users see a response within 20 ms.

QPS changes with concurrency

Results

ef_search Concurrency Recall@10 QPS Avg latency (ms) P95 latency (ms) P99 latency (ms)
120 1 0.9519 370.73 2.69 3.23 3.67
120 8 0.9525 2593.79 3.07 3.80 4.41
120 16 0.9523 3596.98 4.44 6.16 7.41
120 32 0.9525 3884.38 8.23 11.47 13.35
120 64 0.9524 5352.73 11.94 18.30 21.82
120 128 0.9524 6753.36 18.94 34.27 42.53
160 1 0.9600 343.76 2.90 3.55 4.00
160 8 0.9600 2348.89 3.40 4.24 4.81
160 16 0.9598 3175.30 5.03 6.88 8.21
160 32 0.9599 3347.77 9.55 12.94 14.85
160 64 0.9600 4624.36 13.83 21.32 25.44
160 128 0.9603 5657.66 22.61 41.08 51.13
200 1 0.9647 317.60 3.14 3.88 4.34
200 8 0.9658 2139.50 3.73 4.68 5.33
200 16 0.9657 2843.98 5.62 7.70 9.26
200 32 0.9658 3018.77 10.59 14.24 16.48
200 64 0.9661 4086.58 15.65 24.30 29.03
200 128 0.9657 4879.21 26.22 47.74 59.58

Key observations

  • Throughput scales with concurrency. At ef_search=120, QPS grows from 370 at concurrency 1 to 6,753 at concurrency 128, showing that PolarDB's parallel computing framework uses multi-core resources effectively.

  • Tail latency stays bounded under load. Single-query average latency is 2.69 ms with a P99 of 3.67 ms. Even at 128 concurrent queries with ef_search=200, P99 latency stays below 60 ms.

  • Higher `ef_search` trades throughput for precision. Increasing ef_search from 120 to 200 raises Recall@10 from ~0.952 to ~0.966 (about 1.4% gain). At concurrency 128, QPS drops from 6,753 to 4,879 (~28% decrease) and average latency rises from 18.94 ms to 26.22 ms (~38% increase).

  • Resource saturation appears around concurrency 128. QPS growth slows and P99 latency rises sharply when moving from 64 to 128 concurrent queries. This is normal behavior as CPU cores approach saturation.

Parameter recommendations

Choose ef_search for your scenario

ef_search is set at query time and is the primary lever for balancing precision and performance.

Scenario Recommended ef_search Effect
Online services, latency-sensitive 120 Highest QPS and lowest latency at acceptable recall (~0.952)
Batch analytics, high precision required 200 or higher Higher recall (~0.966+) at the cost of throughput

Set index-building parameters

max_degree and ef_construction are fixed at index creation time. They determine the HNSW graph structure and affect build time, memory usage, and query performance.

  • max_degree: Maximum number of connections per node in the HNSW graph.

  • ef_construction: Dynamic neighbor list size during index building.

Scenario max_degree ef_construction Effect
High recall priority 32 or 64 400 or 500 Denser graph improves recall but increases build time and memory.
Fast build / low memory 12 or 16 100 or 200 Sparser graph builds faster with lower memory at some recall cost.
This test (balanced) 16 200 A balance between recall, performance, and resource use.