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 %.
LOAD DATA statementsanio = 2024StarRocks 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.
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.
| File | Gzipped | Uncompressed | Lines | Bytes per row |
|---|---|---|---|---|
contratos_i.tsv | 121.9 MB | 392,773,062 | 856,422 | 459 |
contratos_ii.tsv | 72.7 MB | 299,306,994 | 453,172 | 660 |
| Total | 194.6 MB | 692,080,056 | 1,309,594 | 528 |
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.
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.
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.
| # | Symptom | Cause | Fix |
|---|---|---|---|
| 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. |
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.
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');
| Source | Rows loaded | Sum of value (bn) | Wall clock |
|---|---|---|---|
| SECOP I | 856,422 | 116,729.26 | — |
| SECOP II | 453,172 | 8,564,490.30 | — |
| Both files | 1,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.
Stream Load over HTTP on 8030, one request per file, with a label that makes a retry idempotent.
| File | Total rows | Loaded | Filtered | Load time | Throughput |
|---|---|---|---|---|---|
contratos_i.tsv | 856,422 | 856,422 | 0 | 18.8 s | 20.9 MB/s |
contratos_ii.tsv | 453,172 | 453,172 | 0 | 7.0 s | 42.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.
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.
| Measure | StarRocks | MySQL | CSV lines | Verdict |
|---|---|---|---|---|
fuente = 'I' | 856,422 | 856,422 | 856,422 | Equal |
fuente = 'II' | 453,172 | 453,172 | 453,172 | Equal |
COUNT(*) | 1,309,594 | 1,309,594 | 1,309,594 | Equal |
| Predicate | Expected | StarRocks | MySQL | Delta |
|---|---|---|---|---|
LOWER(entidad) LIKE '%bogot%' · SECOP I | 51,338 | 51,545 | 51,545 | +0.40 % |
LOWER(entidad) LIKE '%bogot%' · SECOP II | 5,457 | 5,444 | 5,444 | −0.24 % |
LOWER(detalle) LIKE '%computadores%' · SECOP I | 1,837 | 1,848 | 1,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.
LIKE means two different questionsStarRocks 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:
| Predicate | StarRocks | MySQL | What it proves |
|---|---|---|---|
entidad LIKE '%bogota%' | 0 | 51,545 | Nothing about speed: the engines answered different questions. |
LOWER(entidad) LIKE '%bogot%' | 51,545 | 51,545 | Same 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.
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.
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.
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:
| Year | Rows in subset | Full source / 13 |
|---|---|---|
| 0 (no date) | 120,778 | the 120,778 null-marker rows, exactly |
| 2023 | 64,995 | 64,719 |
| 2024 | 71,901 | 71,932 |
| 2025 | 80,126 | 80,083 |
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.
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.
sql/06_f4_verification.out.txt — this report as raw measurements, including the exact JSON of both Stream Load responses.sql/03_export_spec.sql · sql/04_load_mysql.sql · load.sh · scripts/export.ps1 — the four files that produced these numbers.data/ — the two gzipped TSVs (194.6 MB) and their decompressed twins (0.69 GB).