← Status board  /  Phase 4

Phase 4 — Export and load into both engines One predicate, two files, two load paths, and the four checks that decide whether Phase 5 is measuring anything real. Three integrity failures were caught here before they could reach the benchmark, plus two engine semantics that would have turned a collation difference into a fake speed difference.

Status complete Rows 1,309,594 Filtered 0 on both loads Size 0.69 GB · 194.6 MB gzipped Next Phase 5 · Benchmark

1 Summary

The subset was exported from the production server with the predicate frozen in Phase 2, flattened to a line-safe TSV, and loaded into both engines. The gate was not "the load succeeded" — a load can succeed while dropping rows — but four separate equalities: rows on both engines, rows against the CSV, filtered rows at zero, and the three reference counts inside ±1 %.

Rows loaded
1,309,594
856,422 + 453,172 · identical everywhere
MySQL load
379.4 s
two LOAD DATA statements
StarRocks load
26.2 s
19.1 s + 7.1 s · 0 rows filtered
Pruning
1/25
partitions opened for anio = 2024
Headline

StarRocks loaded the same 1.3 M rows 14.5× faster than MySQL's LOAD DATA — 26.2 s against 379.4 s. This is a load number, not a query number: it is reported once, labelled, and kept out of the benchmark table in Phase 5.

2 Export

The SQL is base64-encoded before it leaves the Windows host, which removes an entire class of quoting damage between PowerShell, SSH and the remote shell. Compression happens on the server, in the pipe, so nothing uncompressed crosses the network.

FileGzippedUncompressedLinesBytes per row
contratos_i.tsv121.9 MB392,773,062856,422459
contratos_ii.tsv72.7 MB299,306,994453,172660
Total194.6 MB692,080,0561,309,594528

194.6 MB is 0.0019 % of the 10 TB monthly egress allowance on OCI — under two thousandths of one percent. The transfer cost of this experiment is zero, and the reason to compress was time, not money.

Size: the estimate that was wrong by 3.9×

Phase 2 estimated ≈2.7 GB, derived from .ibd size divided by row count. The measured export is 0.69 GB. The .ibd files carry the four and seven FULLTEXT trees and page padding; a TSV of the same rows carries neither. 528 bytes per row, not 2.06 KB. The correction is recorded here and on the status board rather than quietly replaced.

3 Three integrity failures, in the order they appeared

All three were caught by checks the plan already required. None of them produced an error at the point of failure — each would have produced a plausible-looking dataset.

#SymptomCauseFix
1 453,172 rows exported, 718,639 lines written mysql --batch --raw leaves embedded CR/LF inside objeto_contrato and descripcion_proceso; each one split a row across several lines. Flatten CR, LF and TAB to spaces in the SELECT, identically for both tables. No effect on LIKE semantics; the alternative — escaping and unescaping on both sides — would have created two new places to be wrong.
2 ERROR 1292: Incorrect date value: 'NULL' after 0.9 s --raw emits a SQL NULL as the four characters NULL, not as \N. The DATE column refused the literal string, which is the only reason the problem surfaced at all. Rewrite the markers to a single \N — 88,408 in SECOP I and 32,370 in SECOP II, 120,778 total — and convert them per column with NULLIF(@col,'\N').
3 The \N markers still did not convert My own conversion wrote four backslashes instead of one. With ESCAPED BY '' the comparison is literal, so \\\\N never matched. Replaced the inline one-liner with a file-based script and verified by reading bytes, not by trusting the console. Same lesson as the third row: printing a value is not the same as inspecting it.
Why this section exists

A dataset that is 20 % short, or whose text contains literal NULL strings, still loads, still answers queries and still produces a clean-looking benchmark. The only defence is an equality that fails loudly — row counts on three sides, a typed column that refuses garbage, and NumberFilteredRows required to be zero.

4 MySQL load

Two LOAD DATA INFILE statements inside the container, reading the files from /var/lib/mysql-files.

LOAD DATA INFILE '/var/lib/mysql-files/contratos_i.tsv'
INTO TABLE secop.contratos
CHARACTER SET utf8mb4
FIELDS TERMINATED BY '\t' ESCAPED BY ''
LINES TERMINATED BY '\n'
(@anio, @id, ... , @mpio)
SET entidad = NULLIF(@entidad,'\N'), ... , municipio = NULLIF(@mpio,'\N');
SourceRows loadedSum of value (bn)Wall clock
SECOP I856,422116,729.26—
SECOP II453,1728,564,490.30—
Both files1,309,594—379.4 s

The value sums are printed by the load script as a second, independent signal: a shifted column would keep the row count perfect and move the money. They are not used as a benchmark figure.

5 StarRocks load

Stream Load over HTTP on 8030, one request per file, with a label that makes a retry idempotent.

FileTotal rowsLoadedFilteredLoad timeThroughput
contratos_i.tsv856,422856,422018.8 s20.9 MB/s
contratos_ii.tsv453,172453,17207.0 s42.8 MB/s

The first attempt failed with {"status":"FAILED","msg":"Need auth information."} — StarRocks 3.5 requires the Basic header on Stream Load even when the root password is empty. Retried with -u root: and a fresh label; the failed transaction left nothing behind.

The check that matters

strict_mode: false lets StarRocks accept rows it cannot fully parse. Without comparing NumberLoadedRows against the file's line count and requiring NumberFilteredRows = 0, a load can report Success while quietly discarding thousands of rows. The script exits non-zero on any difference and prints the ErrorURL, whose detail lives on the BE at 8040.

6 Verification

Counts

MeasureStarRocksMySQLCSV linesVerdict
fuente = 'I'856,422856,422856,422Equal
fuente = 'II'453,172453,172453,172Equal
COUNT(*)1,309,5941,309,5941,309,594Equal

Reference counts inside the subset

PredicateExpectedStarRocksMySQLDelta
LOWER(entidad) LIKE '%bogot%' · SECOP I51,33851,54551,545+0.40 %
LOWER(entidad) LIKE '%bogot%' · SECOP II5,4575,4445,444−0.24 %
LOWER(detalle) LIKE '%computadores%' · SECOP I1,8371,8481,850+0.60 %

All three inside the ±1 % tolerance. The 2-row gap on the last line is the only place the engines disagree on a count, and it is explained in the next section.

7 Two semantics traps that would have faked a result

1 · The same LIKE means two different questions

StarRocks compares strings byte-exact. MySQL's table collation is utf8mb4_0900_ai_ci, which is case- and accent-insensitive. The stored values are uppercase (BOGOTÁ), so:

PredicateStarRocksMySQLWhat it proves
entidad LIKE '%bogota%'051,545Nothing about speed: the engines answered different questions.
LOWER(entidad) LIKE '%bogot%'51,54551,545Same question, same rows — usable in a benchmark.

Consequence for Phase 5, now a rule in the plan: every query text is ASCII-only and wrapped in LOWER(). Otherwise the benchmark measures collation and calls it engine speed.

2 · Distinct counts are not comparable

COUNT(DISTINCT entidad) returns 13,270 on StarRocks and 13,252 on MySQL over identical rows, because ai_ci collapses BOGOTÁ and Bogotá into one value. Any query of that shape is labelled non-comparable rather than reported as a difference between engines.

False alarm, worth recording

The MySQL console printed BOL锟絍AR. That looked like corrupted UTF-8 and would have discredited the whole load. HEX(entidad) returned 424F4CC38D564152… — BOL + U+00CD + VAR, with LENGTH 22 and CHAR_LENGTH 20. The data was correct; the Windows console code page was lying. Same class of error as the over-escaped \N: print a value and you learn nothing, inspect the bytes and you learn the truth.

8 Pruning, now with data

Phase 3 left this open because EXPLAIN on an empty table returns EMPTYSET. With 1.3 M rows loaded:

EXPLAIN SELECT COUNT(*) FROM secop.contratos WHERE anio = 2024;

0:OlapScanNode
   TABLE: contratos
   partitions=1/25
   rollup: contratos
   tabletRatio=4/4
   tabletList=10420,10422,10424,10426
   cardinality=52383

One partition of 25 opened, all four buckets inside it. Year counts confirm the data landed where the DDL said it would:

YearRows in subsetFull source / 13
0 (no date)120,778the 120,778 null-marker rows, exactly
202364,99564,719
202471,90171,932
202580,12680,083
Consistency worth stating

anio = 0 holds exactly 120,778 rows — the same number as the null markers corrected during this phase. Two independent paths, one number. That is the kind of agreement the gate is looking for, and it is stronger evidence than either number alone.

9 Gate

Gate met

COUNT(*) identical on both engines and equal to the CSVs (1,309,594); NumberFilteredRows = 0 on both loads; the three reference counts at +0.40 %, −0.24 % and +0.60 % of expected; partition pruning demonstrated at partitions=1/25. Every item on the original gate list is satisfied with a measured number.

10 Evidence