The question was never "is StarRocks faster". It was in which queries, by how much, and why. Four queries were fixed before any measurement, each with a predicted winner, and all four landed where the hypothesis said they would — including the loss.
StarRocks wins wherever the question is an aggregation over many rows, loses where the question is one row by key, and the gap in every case is explained by the plan: temporary tables and nested loops on one side, columnar scans and vectorised hash aggregation on the other.
| Rule | How it was applied |
|---|---|
| Warm cache, both sides | 2 warm-up runs per query per engine, discarded. The measured runs therefore never pay for the first read of a page. |
| Never the best time | 5 measured runs; median and p95 are reported. The best run appears in the CSV as min_ms and is used nowhere in this report. |
| Same client, measured overhead | Both engines are queried with the same mysql binary inside the same container. The cost of one empty round trip was measured first — 80 ms to StarRocks, 75 ms to MySQL — and is reported next to every figure so it can be subtracted by the reader. |
| Result proven, not assumed | Each query's output is normalised (decimals to two places) and checksummed. Identical checksums on Q1, Q3 and Q4 prove both engines returned the same rows, not just the same number of rows. |
A point lookup that answers in 5 ms cannot be measured with a 75 ms instrument and reported as "80 ms". Every table below therefore carries a second row: the median with the baseline subtracted. For Q1 to Q4 the subtraction changes the ratio by tens of percent, so hiding it would have been a choice, not an oversight.
| Query | StarRocks median | MySQL median | Ratio | p95 SR | p95 MY | Winner |
|---|---|---|---|---|---|---|
| Q1 | 334 ms | 43,425 ms | 130.0× | 391 ms | 48,695 ms | StarRocks |
| Q2a | 648 ms | 14,670 ms | 22.6× | 719 ms | 16,747 ms | StarRocks |
| Q3 | 173 ms | 80 ms | 0.46× | 192 ms | 98 ms | MySQL |
| Q4 | 472 ms | 27,429 ms | 58.1× | 588 ms | 34,403 ms | StarRocks |
| Query | SR adjusted | MySQL adjusted | Ratio | Reading |
|---|---|---|---|---|
| Q1 | 254 ms | 43,350 ms | 170.7× | The gap grows when the constant is removed — it was never an artefact of the client. |
| Q2a | 568 ms | 14,595 ms | 25.7× | Same direction, slightly larger. |
| Q3 | 93 ms | 5 ms | 0.05× | The loss is 18.6×, not 2.2×. Without the baseline, Q3 flatters StarRocks. |
| Q4 | 392 ms | 27,354 ms | 69.8× | Same direction, larger. |
2.2× is what a stopwatch on the command line says. 18.6× is what the engines actually cost. The report uses the adjusted figure for the loss and states both, because a benchmark that under-reports its own losses is not a benchmark.
| Query | Engine | min | median | p95 | max | Rows |
|---|---|---|---|---|---|---|
| Q1 | SR | 318 | 334 | 391 | 399 | 50 |
| Q1 | MY | 41,872 | 43,425 | 48,695 | 49,094 | 50 |
| Q2a | SR | 555 | 648 | 719 | 736 | 1 |
| Q2a | MY | 13,125 | 14,670 | 16,747 | 16,903 | 1 |
| Q3 | SR | 126 | 173 | 192 | 193 | 1 |
| Q3 | MY | 72 | 80 | 98 | 100 | 1 |
| Q4 | SR | 449 | 472 | 588 | 600 | 100 |
| Q4 | MY | 25,119 | 27,429 | 34,403 | 35,580 | 100 |
Both engines produce the same 50 rows, checksum 1afc3c24…. The difference is entirely in how they get there.
OLAP_SCAN 1,309,594 rows 164.9 ms ScanTime AGGREGATION [partial] 122,394 groups 390.9 ms CPU SHUFFLE 23.7 ms AGGREGATION [final] 74,833 groups 69.7 ms TOP_N 50 rows 1.9 ms
One columnar read of the columns the query names, a partial aggregation per bucket, a shuffle of 122k partial groups, a merge to 74.8k, and a top-N. There is no point in the plan where a whole row is assembled.
Table scan on contratos 1.31 M rows 6,044 ms Aggregate using temporary 74,833 groups 43,015 ms Sort total DESC, LIMIT 50 43,134 ms
The scan is 6 seconds. The other 37 are the temporary table: with no index on (codigo_entidad, anio) MySQL cannot stream the GROUP BY, so it maintains 74,833 groups row by row and then sorts the result.
It is not "MySQL is a bad database". It is a row store doing a job it was not indexed for, against a columnar engine doing the job it was built for. Add a covering index and this number changes; the point of the query is that nobody indexes a 1.3 M-row table for every ad-hoc aggregation.
LIKE '%computadores%' is the one text question both engines answer by reading everything: a leading wildcard rules out a B-tree, and MySQL's FULLTEXT index cannot serve it either. This is the fair text comparison, and it is separate from the annex in section 9.
| Engine | Median | Rows | Checksum |
|---|---|---|---|
| StarRocks | 648 ms | 2,018 | 35f0d6be… |
| MySQL | 14,670 ms | 2,020 | bd3650b0… |
The checksums differ, and the reason is not performance: MySQL's utf8mb4_0900_ai_ci folds the accent in CÓMPUTADORES, StarRocks compares bytes. Two extra rows out of 2,020 — 0.1 %. The timings remain comparable because both engines scanned the same 1.31 M rows; the predicates differ by one accent rule, not by a different question.
Without LOWER(), StarRocks returns zero rows, because the stored text is uppercase and its comparison is byte-exact. Running that version would have produced a spectacular, entirely fake 0 ms "win". The rule went into the query files before measurement, not after seeing an odd number.
One row by (anio, id): StarRocks 173 ms, MySQL 80 ms. Adjusted: 93 ms against 5 ms.
InnoDB clusters the table on PRIMARY KEY (id). The row lives inside the B-tree, so the lookup is three or four page levels and the row is already in the buffer pool. There is nothing to assemble: the page is the row.
The sort key is (anio, id) and the data is bucketed by hash; finding one row still means planning the query, opening the partition, reading the bucket and assembling fourteen columns from separate column files. That is the price of the columnar model, and it is paid on every point lookup.
WHERE id = ? alone would scan all 25 partitions and turn a 2.2× loss into a 50× one. That would be a real number about a query nobody writes. The pair (anio, id) is what the sort key supports and what a person with a contract reference and a year would actually type.
Same 100 rows, checksum 1702ec04…. The dimension entidades holds 13,183 rows on both engines, built from the same subset with the same statement.
Hash join against a 13k-row build side, filter on anio >= 2020, two-stage vectorised aggregation, top-N. The plan the optimiser produced is the plan the query asks for.
Table scan on c 4,669 ms Filter anio >= 2020 570,192 rows Nested loop + 570,192 single-row index lookups 4,994 ms Aggregate into temporary 13,069 ms HAVING + Sort 22,847 ms total
The optimiser chose a nested loop with one index lookup per surviving row instead of a hash join, then built another temporary table to group. Two serial costs where StarRocks pays one parallel one.
Fair question, because the queries cast the sum to DECIMAL(20,0) so the two engines print identical integers. Decimal arithmetic is slower than double, and if it penalised only the row store the ratio would be inflated. So it was measured.
| Q1 variant | StarRocks | MySQL | Ratio | Note |
|---|---|---|---|---|
SUM(CAST(... AS DECIMAL(20,0))) | 334 ms | 43,425 ms | 130× | The measured figure used everywhere else in this report. |
SUM(valor) plain double | ≈ 425 ms | ≈ 36,545 ms | 86× | Control: 2 MySQL runs (32,902 / 40,189 ms), 5 StarRocks runs (346–446 ms). |
The cast costs MySQL 3–7 seconds of its 43 and StarRocks about 100 ms. So the 130× is inflated by roughly 50 % against the plain-double figure of 86×, and both are published. The cast stays because it is what makes the checksum meaningful: without it the two engines sum in different orders and the last bits of the double differ, which would turn a proof of equality into noise.
Not comparable, kept out of the results table. It answers a different question: what does each engine do when allowed to use its own text machinery?
| Engine / path | Median | Rows | Status |
|---|---|---|---|
MySQL · MATCH…AGAINST (FULLTEXT) | 65 ms | 1,979 | Runs 55–105 ms over five runs. |
MySQL · LIKE (same column, same word) | 14,670 ms | 2,020 | From Q2a. |
| StarRocks · native text | — | — | Not available on this table. |
MySQL's FULLTEXT path is ≈226× faster than its own LIKE on the same column. The gap inside one engine is larger than the gap between the two engines — so the lesson of the annex is not "MySQL beats StarRocks at text", it is "whoever does not use the native index loses two orders of magnitude against themselves".
Two attempts, two different errors, both measured on 3.5.21:
ALTER TABLE ... ADD INDEX idx_detalle_inv (detalle) USING INVERTED;
-> ERROR 1064: Unexpected input 'INVERTED',
the most similar input is {'VECTOR', 'GIN', 'BITMAP', 'NGRAMBF'}
ALTER TABLE ... ADD INDEX idx_detalle_inv (detalle) USING GIN;
-> ERROR 1064: GIN does not support replicated mode.
The table carries "replicated_storage" = "true", the default in this build, and GIN — the inverted index — refuses to coexist with it. A third probe confirms what the engine expects at query time:
SELECT COUNT(*) FROM contratos WHERE detalle MATCH 'computadores';
-> ERROR 1064: Match can only used as a pushdown predicate
on column with GIN in a single query.: BE:10001
Producing a twin would mean recreating the table with replicated_storage = false, reloading 1.31 M rows and re-running every measurement — which invalidates the numbers already taken. That was not done, and this annex reports an absence rather than a comparison.
Complete CSV with engine, query, run, milliseconds, rows and checksum; identical checksums on the three comparable queries; a stored profile for Q1 and Q4 on both engines; the annex labelled non-comparable and kept out of the results table; every claim in this report traceable to a line in results/phase5/ or sql/0*_*.out.txt.