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:
# 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-downbench-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 Type | Matches | MySQL | MygramDB | Speedup |
|---|---|---|---|---|
| Multi-word ("quantum physics") | 104 | 2928.44ms | 15.19ms | 193x |
| Medium-freq ("quantum") | 1,961 | 2072.03ms | 62.75ms | 33x |
| Low-freq ("algorithm") | 2,498 | 375.14ms | 12.78ms | 29x |
| Rare term ("fibonacci") | 84 | 1172.29ms | 53.66ms | 22x |
CJK Search Latency (SORT id LIMIT 100)
CJK Search Latency (SORT id LIMIT 100) (p50, log scale)
| Query | Matches | MySQL | MygramDB | Speedup |
|---|---|---|---|---|
| 日本 | 32,282 | 917.03ms | 20.64ms | 44x |
| 東京 | 6,989 | 201.51ms | 4.39ms | 46x |
| 科学 | 1,551 | 3.35ms | 2.49ms | 1x |
COUNT Performance
COUNT Performance (p50, log scale)
| Query Type | Count | MySQL | MygramDB | Speedup |
|---|---|---|---|---|
| Medium-freq ("quantum") | 1,961 | 2000.08ms | 82.76ms | 24x |
| Low-freq ("algorithm") | 2,498 | 469.95ms | 14.06ms | 33x |
Result Consistency
| Query | MySQL | MygramDB | Match |
|---|---|---|---|
| quantum | 1,961 | 1,961 | exact |
| algorithm | 2,498 | 2,498 | exact |
| 日本 | 32,282 | 32,282 | exact |
| 科学 | 1,551 | 1,551 | exact |
Concurrent Throughput
Concurrent Throughput — QPS
Query: "algorithm", 10 seconds per connection level.
| Connections | MySQL QPS | MygramDB QPS | MySQL p50 | MygramDB p50 |
|---|---|---|---|---|
| 1 | 2.51 | 83 | 399.71ms | 11.86ms |
| 4 | 7.09 | 245 | 569.23ms | 16.45ms |
Memory Usage
| Documents | Index | Documents + Text | Total RSS | Per 1M docs |
|---|---|---|---|---|
| 1,100,000 | 152MB | 1.78GB | 3.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.