← Status board  /  Phase 6

Phase 6 — StarRocks vs MySQL 8.0.46 on SECOP contracts The technical report, rendered from 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 →

Status complete Blocks 12 Charts 10 Runs behind it 40 Next Phase 7 · Video

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.

1 The question, and the bar for calling something a win

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:

QueryQuestionPredicted winner
Q1Total value and contract count per entity code and year, top 50StarRocks
Q2aDoes the contract text contain a word (LIKE '%…%')tie or StarRocks
Q3One full row by (anio, id)MySQL
Q4Top 100 entity-years by value, joined to a dimension tableStarRocks

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.

2 The data, and exactly how much of it

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 ISECOP IITotal
Rows in source11,120,8775,887,39617,008,273
Rows in subset856,422453,1721,309,594
Payload in source21.89 GB13.97 GB35.86 GB
On disk as TSV0.39 GB0.30 GB0.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.

3 The environment

StarRocksMySQL
Version3.5.21-85fccf88.0.46
Image (pinned by digest)starrocks/allin1-ubuntu 5.18 GBmysql:8.0.46 1.10 GB
Shape1 FE + 1 BE in one container1 instance
Memory limit4 GiB4 GiB
CPU limit44
StorageZSTD columnar, 25 partitions, 100 tabletsInnoDB, 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.

4 Method

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.

5 The answer

QueryStarRocksMySQLRatioAdjusted (client removed)Winner
Q1 aggregation334 ms43,425 ms130×254 ms vs 43,350 ms → 171×StarRocks
Q4 join + top-N472 ms27,429 ms58×392 ms vs 27,354 ms → 70×StarRocks
Q2a substring648 ms14,670 ms22.6×568 ms vs 14,595 ms → 25.7×StarRocks
Q3 point lookup173 ms80 ms0.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.

6 Why StarRocks wins Q1: 37 seconds of temporary table

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.

7 Why StarRocks wins Q4: the join MySQL chose to do the hard way

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.

8 The text question, and the annex that is not a comparison

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.

9 What would change the answer

to exploit. Q1 and Q4 would improve by some factor nobody measured here.

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.

10 Reproducibility and where each figure lives

FigureSource file
Row counts, sizes, reference counts, year distributionsql/00_discover.out.txt, sql/01_diagnostics.out.txt
Subset predicate and column ordersql/03_export_spec.sql
Export and load verification, pruningsql/06_f4_verification.out.txt
Per-run milliseconds, medians, p95, checksumsresults/phase5/raw.csv, results/phase5/summary.csv
Controls: plain SUM, Q2a counts, FULLTEXT timingsql/08_control.out.txt
MySQL planssql/09_explain_mysql.out.txt
StarRocks profilesql/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.

11 Statistical analysis

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

QueryEngineminQ1medianQ3maxmeanSDCV95 % CI (t, df = 4)
Q1StarRocks31833033435939934832.29.25 %308.1–387.9
Q1MySQL41,87243,36243,42547,09849,09444,9703,004.46.68 %41,240.3–48,700.1
Q2aStarRocks55558464865273663570.111.04 %548.0–722.0
Q2aMySQL13,12514,04814,67016,12216,90314,9741,533.610.24 %13,069.7–16,877.5
Q3StarRocks12615217318619316627.316.43 %132.1–199.9
Q3MySQL7277809010083.811.213.35 %69.9–97.7
Q4StarRocks44945847254160050464.712.84 %423.7–584.3
Q4MySQL25,11925,21627,42929,69735,58028,6084,326.215.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

QueryMedian ratio (MY / SR)Exact pCI overlapReading
Q1130.01×0.0079noneComplete separation of the two samples.
Q2a22.64×0.0079noneComplete separation.
Q30.46×0.0079noneComplete separation in MySQL's favour.
Q458.11×0.0079noneComplete 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×.

12 Cross-engine comparison tables

Everything the experiment touched, side by side, so the timing table can be read in context rather than in isolation.

Engine and load

DimensionStarRocks 3.5.21-85fccf8MySQL 8.0.46
Image, pinned by digest5.18 GB (allin1-ubuntu)1.10 GB
Memory at rest852 MiB of 4 GiB457 MiB of 4 GiB
CPU limit44
Rows loaded1,309,5941,309,594
Rows rejected by the loader00
Load wall clock26.2 s (19.1 + 7.1)379.4 s
Load throughput26.4 MB/s1.82 MB/s
Physical layout25 partitions · 100 tablets · ZSTD columns1 tablespace · clustered PK + 2 secondary + 1 FULLTEXT
Point lookup pathsort key (anio, id), hash bucket, column assemblyclustered index leaf, row already assembled

Verification

QueryRows StarRocksRows MySQLChecksumVerdict
Q15050identicalSame result
Q2a1 (value 2,018)1 (value 2,020)differsCollation: 2 rows of 2,020
Q311identicalSame result
Q4100100identicalSame 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:

OperatorRowsWhy the number differs
MATCH…AGAINST (FULLTEXT)23,372Tokenised: a word glued to punctuation is not the term
LIKE '%computadores%'23,883Substring: matches inside other words and next to punctuation
LIKE BINARY5,358Byte-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.

The one-paragraph version

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.