Skip to content

Benchmarks

The tables and charts below are rendered from the measured benchmark snapshot. The run uses the same dataset and query cache setting for every result shown here.

Reproducible

Run the benchmark in a clone of the repository:

bash
# Requires Docker Compose and Rye.
make bench-up

# Wait for "Seed Data Load Complete" and MygramDB's "server_ready" log entry.
make bench-logs

make bench-run
make bench-down

bench-down removes the benchmark containers and volumes. The benchmark Compose configuration disables MygramDB's query cache.

Benchmark Environment

1,100,000 Wikipedia articles, MySQL 8.4.10 FULLTEXT (ngram parser), MygramDB v1.9.0, verify_text: all, and the query cache disabled. Latencies are p50 over 10 iterations.

Search Latency (SORT id LIMIT 100)

Search Latency (SORT id LIMIT 100) (p50, log scale)

Query TypeMatchesMySQLMygramDBSpeedup
Multi-word ("quantum physics")1042928.44ms15.19ms193x
Medium-freq ("quantum")1,9612072.03ms62.75ms33x
Low-freq ("algorithm")2,498375.14ms12.78ms29x
Rare term ("fibonacci")841172.29ms53.66ms22x

CJK Search Latency (SORT id LIMIT 100)

CJK Search Latency (SORT id LIMIT 100) (p50, log scale)

QueryMatchesMySQLMygramDBSpeedup
日本32,282917.03ms20.64ms44x
東京6,989201.51ms4.39ms46x
科学1,5513.35ms2.49ms1x

COUNT Performance

COUNT Performance (p50, log scale)

Query TypeCountMySQLMygramDBSpeedup
Medium-freq ("quantum")1,9612000.08ms82.76ms24x
Low-freq ("algorithm")2,498469.95ms14.06ms33x

Result Consistency

QueryMySQLMygramDBMatch
quantum1,9611,961exact
algorithm2,4982,498exact
日本32,28232,282exact
科学1,5511,551exact

Concurrent Throughput

Concurrent Throughput — QPS

Query: "algorithm", 10 seconds per connection level.

ConnectionsMySQL QPSMygramDB QPSMySQL p50MygramDB p50
12.5183399.71ms11.86ms
47.09245569.23ms16.45ms

Memory Usage

DocumentsIndexDocuments + TextTotal RSSPer 1M docs
1,100,000152MB1.78GB3.41GB~3.1GB

Docker Desktop was allocated 32 GiB; 31.29 GiB was visible to the containers.

verify_text modes

  • off (default): Lower memory use, but n-gram false positives are possible.
  • all: Stores document text for post-filter verification and returns the same counts as MySQL FULLTEXT in this run.

See Why MySQL FULLTEXT is Slow for architectural details, and Comparison for product trade-offs.