INFORME.md. The markdown file is the deliverable; this page exists so the result can be read like every other phase, with the charts and the statistics that the markdown carries as tables. Open the source file →
Which queries are substantially faster on StarRocks, which are not, and why.
Laboratory report · 2026-11-25 · every figure measured on this machine, none estimated.
The question is not whether a columnar engine beats a row store. On 1.3 million rows of Colombian public-procurement data, four queries were fixed before any measurement, two where StarRocks was expected to dominate and two where it was expected to lose:
| Query | Question | Predicted winner |
|---|---|---|
| Q1 | Total value and contract count per entity code and year, top 50 | StarRocks |
| Q2a | Does the contract text contain a word (LIKE '%…%') | tie or StarRocks |
| Q3 | One full row by (anio, id) | MySQL |
| Q4 | Top 100 entity-years by value, joined to a dimension table | StarRocks |
The result is reported against the prediction, including where the prediction was that StarRocks would lose. A benchmark that only publishes its wins is a brochure.
The subset is 1,309,594 rows — 7.70 % of the 17,008,273 rows in the source. It occupies 0.69 GB uncompressed as TSV, 194.6 MB gzipped, and it was produced by CRC32(identifier) % 13 = 0, applied identically to both source tables.
| SECOP I | SECOP II | Total | |
|---|---|---|---|
| Rows in source | 11,120,877 | 5,887,396 | 17,008,273 |
| Rows in subset | 856,422 | 453,172 | 1,309,594 |
| Payload in source | 21.89 GB | 13.97 GB | 35.86 GB |
| On disk as TSV | 0.39 GB | 0.30 GB | 0.69 GB |
The source is a MySQL 8.0.46 instance on Oracle Cloud (pidecerca-prod), read over SSH on a local socket, read-only: no installs, no writes, no DDL on the production server at any point.
The cut is a hash modulo, not a year slice, because one recent SECOP II year alone is 2.2–2.5 GB of CSV — three times the memory budget — and because the queries ask questions that span years. It is the same predicate on both tables, so the two halves of every comparison stay consistent.
What the cut costs, stated up front:
source. The comparison between engines is valid; the extrapolation is not.
across all 25 partitions, so partition pruning is a demonstrated plan property, never an explanation for a speed difference.
rows, which is why the query set uses terms with thousands of hits.
| StarRocks | MySQL | |
|---|---|---|
| Version | 3.5.21-85fccf8 | 8.0.46 |
| Image (pinned by digest) | starrocks/allin1-ubuntu 5.18 GB | mysql:8.0.46 1.10 GB |
| Shape | 1 FE + 1 BE in one container | 1 instance |
| Memory limit | 4 GiB | 4 GiB |
| CPU limit | 4 | 4 |
| Storage | ZSTD columnar, 25 partitions, 100 tablets | InnoDB, 1 GB buffer pool |
Host: Windows 11, Docker 29.9.3, Compose v5.7.1, WSL2 kernel 6.6.87.2, overlayfs, 8 vCPU, 24.89 GB RAM. Both containers on loopback only. Memory at rest: 852 MiB (StarRocks) and 457 MiB (MySQL) of their 4 GiB ceilings.
Both tables hold the same fourteen columns. StarRocks models them as DUPLICATE KEY(anio, id) partitioned by year; MySQL as a row store with PRIMARY KEY (id), two secondary indexes and one FULLTEXT index. That asymmetry is the experiment, not an oversight.
CSV and is used nowhere in this report.
trip costs 80 ms to StarRocks and 75 ms to MySQL; that constant is measured, reported, and subtracted in a second table. Where the subtraction changes the conclusion, both figures appear.
checksums on Q1, Q3 and Q4 prove the two engines returned the same rows.
| Query | StarRocks | MySQL | Ratio | Adjusted (client removed) | Winner |
|---|---|---|---|---|---|
| Q1 aggregation | 334 ms | 43,425 ms | 130× | 254 ms vs 43,350 ms → 171× | StarRocks |
| Q4 join + top-N | 472 ms | 27,429 ms | 58× | 392 ms vs 27,354 ms → 70× | StarRocks |
| Q2a substring | 648 ms | 14,670 ms | 22.6× | 568 ms vs 14,595 ms → 25.7× | StarRocks |
| Q3 point lookup | 173 ms | 80 ms | 0.46× | 93 ms vs 5 ms → 0.05× | MySQL |
Tail behaviour (p95): Q1 391 ms vs 48,695 ms · Q2a 719 ms vs 16,747 ms · Q3 192 ms vs 98 ms · Q4 588 ms vs 34,403 ms. The medians are not hiding a bimodal distribution; the tail is as lopsided as the middle.
Q3 is the number to read carefully. A stopwatch on the command line says MySQL wins 2.2×. Remove the client round trip and it wins 18.6× — 5 ms against 93 ms. Both are published because the smaller one flatters StarRocks.
Both engines return the same 50 rows (checksum 1afc3c24…).
StarRocks, 334 ms. One columnar read of the two columns the query names (1,309,594 rows, 165 ms of scan time), a partial aggregation to 122,394 groups, a shuffle, a merge to 74,833, and a top-N that costs 1.9 ms. No row is ever assembled; no index is used because none is needed.
MySQL, 43,425 ms. EXPLAIN ANALYZE splits it cleanly:
Table scan on contratos 1.31 M rows 2.6 → 6,044 ms Aggregate using temporary 74,833 groups 6,044 → 43,015 ms Sort total DESC, LIMIT 50 43,015 → 43,134 ms
The scan is six seconds. The other thirty-seven are a temporary table. With no index covering (codigo_entidad, anio), MySQL cannot stream the GROUP BY: it maintains 74,833 groups row by row and then sorts the result.
This is not "MySQL is slow". It is a row store doing an ad-hoc aggregation it was not indexed for. Indexing the column pair would change the number — and nobody indexes a 1.3 M-row table for every question they might ask.
Sensitivity, disclosed: the queries cast the sum to DECIMAL(20,0) so both engines print identical integers and the checksum means something. Against a plain SUM(valor), MySQL takes 33–40 s and StarRocks ≈0.42 s, i.e. 86× rather than 130×. The cast costs MySQL 3–7 s of its 43. Both ratios are published; quoting 130× without the 86× is quoting half the result.
Same 100 rows (checksum 1702ec04…). The dimension table holds 13,183 rows on both engines, derived from the same subset with the same statement.
StarRocks, 472 ms. Hash join against a 13k-row build side, filter, two-stage vectorised aggregation, top-N.
MySQL, 27,429 ms. The optimiser picked a nested loop with 570,192 single-row index lookups (≈5 s) instead of a hash join, then built another temporary table to group (13.1 s), then sorted (22.8 s total). Two serial costs where StarRocks pays one parallel one.
Q2a, comparable: LIKE '%computadores%' cannot use a B-tree (leading wildcard) nor MySQL's FULLTEXT index. Both engines read everything. StarRocks 648 ms, MySQL 14,670 ms.
The checksums differ, and the reason is not speed: MySQL returned 2,020 rows, StarRocks 2,018. utf8mb4_0900_ai_ci folds the accent in CÓMPUTADORES; the byte-exact comparison does not. Two rows in 2,020 is 0.1 %, and it is a property of the collation, not of the engine.
The trap that was avoided: without LOWER(), StarRocks returns zero rows, because the stored text is uppercase and its comparison is byte-exact. Run carelessly, that version produces a spectacular and entirely fake "0 ms win". The rule went into the query files before measurement, not after an odd number.
Q2b annex — not comparable, excluded from the table above. MySQL with its native index answers the same word in 65 ms (median of 55–105 ms, 1,979 rows). Against its own 14,670 ms with LIKE on the same column, that is ≈226× — a larger gap inside one engine than between the two engines. The lesson is not "MySQL beats StarRocks at text"; it is that whoever does not use the native index loses two orders of magnitude against themselves.
StarRocks has no number here, and the reason is measured, not assumed:
ADD INDEX ... USING INVERTED → Unexpected input 'INVERTED'
ADD INDEX ... USING GIN → GIN does not support replicated mode
WHERE detalle MATCH '…' → Match can only used as a pushdown predicate
on column with GIN in a single query
The table uses replicated_storage = true, the default in this build, and the inverted index refuses to coexist with it. A twin would require recreating the table and re-running every measurement. The absence is reported; it is not turned into a tie.
to exploit. Q1 and Q4 would improve by some factor nobody measured here.
(codigo_entidad, anio)would collapse most of MySQL's 37 seconds. The queries are ad-hoc by design; the report says so rather than pretending indexes do not exist.
survive any sample. The 130× on Q1 depends on 1.3 M rows being large enough for a temporary table to hurt — a smaller table would compress the gap.
normalisation measures ai_ci versus byte comparison, not engine speed.
| Figure | Source file |
|---|---|
| Row counts, sizes, reference counts, year distribution | sql/00_discover.out.txt, sql/01_diagnostics.out.txt |
| Subset predicate and column order | sql/03_export_spec.sql |
| Export and load verification, pruning | sql/06_f4_verification.out.txt |
| Per-run milliseconds, medians, p95, checksums | results/phase5/raw.csv, results/phase5/summary.csv |
| Controls: plain SUM, Q2a counts, FULLTEXT timing | sql/08_control.out.txt |
| MySQL plans | sql/09_explain_mysql.out.txt |
| StarRocks profile | sql/10_profile_starrocks.out.txt |
To repeat the measurement on this machine:
docker compose up -d # both engines, healthy in ~40 s docker cp bench.sh sr-lab:/bench/bench.sh docker cp queries sr-lab:/bench/queries docker exec sr-lab bash /bench/bench.sh # 2 warm-ups + 5 runs per query/engine
Deeper narrative, with the failures and the discarded alternatives, in the phase reports: docs/index.html links all seven.
Five runs per cell is a small sample, and the honest way to treat it is to say what it can and cannot support. It can support a rank comparison — the two distributions do not overlap at all — and it cannot support a claim about normality or a precise 99th percentile.
Descriptive statistics, all eight cells
| Query | Engine | min | Q1 | median | Q3 | max | mean | SD | CV | 95 % CI (t, df = 4) |
|---|---|---|---|---|---|---|---|---|---|---|
| Q1 | StarRocks | 318 | 330 | 334 | 359 | 399 | 348 | 32.2 | 9.25 % | 308.1–387.9 |
| Q1 | MySQL | 41,872 | 43,362 | 43,425 | 47,098 | 49,094 | 44,970 | 3,004.4 | 6.68 % | 41,240.3–48,700.1 |
| Q2a | StarRocks | 555 | 584 | 648 | 652 | 736 | 635 | 70.1 | 11.04 % | 548.0–722.0 |
| Q2a | MySQL | 13,125 | 14,048 | 14,670 | 16,122 | 16,903 | 14,974 | 1,533.6 | 10.24 % | 13,069.7–16,877.5 |
| Q3 | StarRocks | 126 | 152 | 173 | 186 | 193 | 166 | 27.3 | 16.43 % | 132.1–199.9 |
| Q3 | MySQL | 72 | 77 | 80 | 90 | 100 | 83.8 | 11.2 | 13.35 % | 69.9–97.7 |
| Q4 | StarRocks | 449 | 458 | 472 | 541 | 600 | 504 | 64.7 | 12.84 % | 423.7–584.3 |
| Q4 | MySQL | 25,119 | 25,216 | 27,429 | 29,697 | 35,580 | 28,608 | 4,326.2 | 15.12 % | 23,237.4–33,979.0 |
Note on the MySQL panel: Q3 lives between 72 and 100 ms, which is a flat line at this scale. It is the point of the chart — the three aggregation queries sit between 13 and 43 seconds, so the one query MySQL wins is invisible next to them.
Two-sided exact Mann–Whitney U, all 252 ways of splitting the ten runs
| Query | Median ratio (MY / SR) | Exact p | CI overlap | Reading |
|---|---|---|---|---|
| Q1 | 130.01× | 0.0079 | none | Complete separation of the two samples. |
| Q2a | 22.64× | 0.0079 | none | Complete separation. |
| Q3 | 0.46× | 0.0079 | none | Complete separation in MySQL's favour. |
| Q4 | 58.11× | 0.0079 | none | Complete separation. |
How to read p = 0.0079. With five runs against five, the smallest p-value a rank test can produce is 2/252 = 0.0079, and that is what all four comparisons return: every StarRocks run is faster than every MySQL run on Q1, Q2a and Q4, and every MySQL run is faster than every StarRocks run on Q3. The correct statement is "the samples do not overlap, so p is at the floor of what this design can detect", not "p = 0.0079 proves a 99.2 % probability". A larger n would lower the floor; it would not change the ordering, which is already total.
What the variance says. StarRocks' coefficient of variation is highest on Q3 (16.4 %) — the query where planning and connection setup dominate a 173 ms measurement — and lowest on Q1 (9.3 %), where 334 ms of real work swamps the noise. MySQL is steadier on Q1 (6.7 %) and least steady on Q4 (15.1 %), where the optimiser's plan and the temporary table interact with whatever else is in the buffer pool. None of this threatens the conclusions: the confidence intervals are separated by more than an order of magnitude in every case.
The sensitivity chart above is the one to keep in view when quoting a single number: every ratio grows when the 75–80 ms client round trip is removed, and the loss on Q3 grows from 2.2× to 18.6×.
Everything the experiment touched, side by side, so the timing table can be read in context rather than in isolation.
Engine and load
| Dimension | StarRocks 3.5.21-85fccf8 | MySQL 8.0.46 |
|---|---|---|
| Image, pinned by digest | 5.18 GB (allin1-ubuntu) | 1.10 GB |
| Memory at rest | 852 MiB of 4 GiB | 457 MiB of 4 GiB |
| CPU limit | 4 | 4 |
| Rows loaded | 1,309,594 | 1,309,594 |
| Rows rejected by the loader | 0 | 0 |
| Load wall clock | 26.2 s (19.1 + 7.1) | 379.4 s |
| Load throughput | 26.4 MB/s | 1.82 MB/s |
| Physical layout | 25 partitions · 100 tablets · ZSTD columns | 1 tablespace · clustered PK + 2 secondary + 1 FULLTEXT |
| Point lookup path | sort key (anio, id), hash bucket, column assembly | clustered index leaf, row already assembled |
Verification
| Query | Rows StarRocks | Rows MySQL | Checksum | Verdict |
|---|---|---|---|---|
| Q1 | 50 | 50 | identical | Same result |
| Q2a | 1 (value 2,018) | 1 (value 2,020) | differs | Collation: 2 rows of 2,020 |
| Q3 | 1 | 1 | identical | Same result |
| Q4 | 100 | 100 | identical | Same result |
Text search, three operators, one question
The same business question — "does the contract mention computers?" — returns three different counts depending on which operator answers it, on the full source:
| Operator | Rows | Why the number differs |
|---|---|---|
MATCH…AGAINST (FULLTEXT) | 23,372 | Tokenised: a word glued to punctuation is not the term |
LIKE '%computadores%' | 23,883 | Substring: matches inside other words and next to punctuation |
LIKE BINARY | 5,358 | Byte-exact: upper case in storage does not match lower case in the pattern |
That 511-row difference between the first two is what forced Q2a and Q2b to be measured separately instead of averaged into one "text search" number.
On this data, StarRocks answers aggregation-shaped questions one to two orders of magnitude faster than MySQL — 130× on a grouped sum, 58× on a join with top-N, 22.6× on a substring search — because it reads only the columns it needs and aggregates vectorised, while MySQL scans rows and spills into temporary tables it has no index to avoid. It loses, structurally and by nearly 19×, when the question is one row by key, because InnoDB's clustered primary key puts the row inside the index and StarRocks has no point index at all. Both outcomes were predicted before the first run, and the mechanism behind each is visible in the query plans.