Proof of concept · status & plan · v0.5

StarRocks vs MySQL 8.0.46 on SECOP procurement data

What gets built, in what order, under which acceptance criteria — and how far it has got. Phase 0 is closed and measured; the full evidence lives in the Phase 0 report, one click away.

92% OVERALL
10 of 12 phases complete
8.3 of 9.05 working days
Date
2026-11-25
Lab host
Windows 11 · Docker Desktop 29.9.3
Source
MySQL 8.0.46 · 129.80.141.192
Access mode
read-only · SSH + socket
Deliverables
8
Progress
Phases 0–6, 8, 9 and 11 complete · 92%
Phases complete
10 / 12
F7 open · F10 next
Rows measured
17,008,273
11,120,877 + 5,887,396 · exact match
Source footprint
46.7 GiB
94 objects · two tables hold 43.1 GB
Subset loaded
1.31 M rows
k = 13 · identical on both engines
01Question and success criteriaThe one question, and the win / tie / loss bar fixed before measuring. 02Lab environmentWhat was measured on this host, and what it implies. 03BlockersAccess, version pin, contract value column — two now closed. 04Implementation phasesF0 to F10 — engines, benchmark, report, video and the dashboard — each with an acceptance gate. 05Subset designMemory budget, strategy A or B, five verification checks. 06The four queriesTwo expected wins, two expected losses, and why. 07Measurement methodologyWarm cache, five runs, median and p95, result checksums. 08Deliverables mapEvery artefact and what makes it acceptable. 09TimelineFive and a half days and the critical path. 10RisksWhat breaks the lab and how it is contained. 11DecisionsWhat is closed, what is still open. 12Start checklistWhat must exist before the first line of code — and what already does.

1 Question and success criteria

The whole lab exists to answer one question, and the plan is judged on whether it answers that question with measured evidence.

On SECOP contracts, in which queries is StarRocks substantially faster than MySQL, in which is it not, and why?
Honesty rule

Losses are part of the expected result (native text search and point lookup). If measurement does not produce them, the report must state that the hypothesis was refuted and show the number — not quietly drop the query.

How to read every result

Three verdicts only. Defined before measuring, so the bar cannot move after the numbers arrive.

WinStarRocks median ≥ 3× faster and p95 keeps ≥ 2×.
TieRatio between 1.2× and 3× either way, or good median with overlapping p95.
LossMySQL ≥ 1.2× faster in median, reproducibly across 5 runs.

Every winning row must name a mechanism (columnar scan, vectorised aggregation, no per-row lookups); every losing row must name the structural cost that causes it. A report that lists winners and stops is not an answer to the question.

2 Lab environment: measured today

Everything below was checked on this machine before the plan was written. None of it is assumed.

ItemMeasured valueImplication for the lab
Docker29.9.3 (build 5457199)OK Docker Desktop is running; nothing to install.
Backend / kernelWSL2 · 6.6.87.2-microsoft-standard · overlayfsRuns linux/amd64 images natively on x86_64, no qemu emulation.
CPU assigned to daemon8 vCPUEnough: the PoC compares engines, not scaling. CPU count will be pinned in compose so both engines see the same.
RAM available to daemon24.89 GB (24,891,322,368 B)Headroom Allows a hard 4 GB cap on StarRocks with room to spare, so the PoC stays reproducible on an 8 GB machine.
Free disk (E:, workspace)168.6 GBPlenty for CSV, volumes and dumps. The subset is sized by memory, never by disk.
Free disk (C:)116.5 GBDocker volumes live on the daemon disk (WSL2, typically C:). Watch it as the image grows.
MySQL client on lab hostnot installed · no pymysqlExtraction will run through the mysql client container, so nothing is installed on the host.
Reachability 129.80.141.192:3306TCP closed (timeout)Resolved Not needed: the source is queried over SSH + local socket, so MySQL stays bound to loopback.
Reachability 129.80.141.192:22TCP openIn use SSH key auth as ubuntu, read-only session.
Official requirements vs. this machine

StarRocks documentation asks for 4 GB RAM and 10 GB disk for Docker, x86 with AVX2 recommended, Ubuntu 22.04 supported. This host clears the minimums comfortably; the 4 GB cap is kept for reproducibility, not because it is needed here. AVX2 must be confirmed inside the container at first boot, since it affects vectorised execution and therefore the validity of every timing.

3 Blockers

Three items gated the start. Two are closed as of 2026-11-25; one remains, and it only blocks the container build.

B1 · Closed  Read access to the source

Resolved with the OCI SSH key: ubuntu@pidecerca-prod, MySQL over the local socket as root@localhost. Port 3306 stays bound to 127.0.0.1; nothing new is exposed to the internet.

Read-only guarantees held: no DDL, no writes, no ANALYZE, nothing installed. Full scans run sequentially, each timed. Key handled through a temp copy with a restricted ACL; the original was never modified.

B2 · Open  StarRocks version to pin

Compose must carry an immutable tag, never :latest. Proposal: the 3.5.x line with the exact tag and digest recorded in the compose file, consistent with the JDK 17+ requirement for 3.5 and above.

Associated risk: whether date_trunc('year', …) expression partitioning exists on the pinned build. Not assumed — tested in Phase 3 on a one-row table, with a literal-year RANGE fallback.

B3 · Closed  Contract value column

The value is numeric, not text: Cuantia_Contrato and valor_contrato are double. No thousands separators, no derived column, no cleaning function.

Measured caveats: 10.9 % of SECOP I rows carry 0, and one row holds an absurd maximum of 3.64e14 that can dominate a SUM. Both facts go in the report; neither changes the comparison, since both engines read the same rows.

Where the evidence is

Column inventory, index map, reference counts, year distribution and value-quality checks: Phase 0 report. The short version: docs/schema-notes.md.

4 Implementation phases

Eleven phases, each with a gate: no phase starts until the previous acceptance criterion is met and recorded. Phase 1 provisions Docker and pins the images. Current state: F0 to F6 complete (100 % each) — Phase 0 results are published — both engines hold the same 1,309,594 rows, zero filtered, the three reference counts inside ±1 % and partition pruning demonstrated at partitions=1/25. F5 complete: StarRocks wins three of four queries — 130× on aggregation, 58× on the join, 22.6× on substring — and loses the point lookup 18.6× once client overhead is removed. F6 complete: INFORME.md states the subset size on page one, publishes both ratios (130× and 86×) and gives the plan behind every win and the loss.

PhaseProgressStatusGate / blocking item
F0 · Schema discovery
100%
CompleteGate met · Phase 0 report →
F1 · Docker provisioning & image pull
100%
CompletePinned: StarRocks 3.5.21 · MySQL 8.0.46 · report
F2 · Subset design & verification
100%
Approvedk = 13 signed off · spec frozen · report
F3 · Compose & DDL
100%
CompleteBoth engines up · 25 partitions · DDL clean · report
F4 · Export & load
100%
Complete1,309,594 rows both engines · 0 filtered · partitions=1/25 · report
F5 · Benchmark & query profiles
100%
Complete3 of 4 queries won · Q3 lost 18.6× · report
F6 · Technical report
100%
Complete12 blocks · 10 charts · report · .md
F7 · Six-minute video
0%
NextUnblocked · video.md
F8 · Dashboard API · Spring Boot
100%
Complete11 endpoints · read-only user · 8 tests · report
F9 · Dashboard · React + Vite
100%
Complete6 KPIs · 10 charts · explainer · report
F10 · Packaging and close
0%
NextUnblocked · API and bundle already run by hand
F11 · Dashboard v2
100%
Complete22 charts · 5 tables · report

Percentages are effort-weighted against 9.05 working days: the original 5.8, plus 1.75 for the three dashboard phases and another 1.5 for the v2 rebuild. That is why the ring reads 70 % with the same seven phases closed — the plan grew, not the work undone. Closing a 0.5-day phase still moves the needle by 6.6 points, not 12.5.

PHASE 0 Schema discovery (read-only) 100 % · complete · 0.5 d   Phase 0 report →
Real columnsinformation_schema.COLUMNS: 85 columns on secop_i_records, 96 on secop_ii_registros. The seven named in the brief all exist; they are a subset.
Indexes4 FULLTEXT on SECOP I and 7 on SECOP II, confirmed by name and column, plus PRIMARY (UID) and PRIMARY (id_contrato).
Physical structureNo partitioning on either table (PARTITION_COUNT = 1). Statistics are stale after today's rebuild — TABLE_ROWS reports 411 k rows against 17 M real ones, so every count uses COUNT(*).
Value columnNumeric (double). Zeros: 1,216,698 (10.9 %). Maximum: 3.64e14, an outlier. No NULLs.
Time columnSECOP II has fecha_firma DATE. SECOP I has only a text date and a varchar year, so its year must be derived to an integer.
Validation667,388 · 70,941 · 23,372 reproduced. The third one required discovering that the brief's figure came from FULLTEXT, not LIKE.
Gate metschema-notes.md exists with types, indexes, value/date decisions and the three reference counts confirmed. Read the full Phase 0 report →
PHASE 1 Docker provisioning and image pull 100 % · complete · 0.3 d   Phase 1 report →
Engine checkdocker --version, docker compose version (v2 plugin required), docker info: backend, storage driver, vCPU and RAM. Today that reads 29.9.3, WSL2, overlayfs, 8 vCPU, 24.89 GB. On this host Docker is already installed, so this phase is verification plus hardening; on a fresh machine it also covers installing Docker Desktop or Engine and enabling the WSL2 backend.
Resource allocationSet an explicit cap in .wslconfig (memory, processors, swap) so the 4 GB container never competes with the host, then restart and confirm the cap through docker info. A container limit without a daemon-level cap is only half a limit.
Port availabilityConfirm 9030, 8030, 8040 and 3306 are free on the host before writing compose. A port already bound produces the classic "container is up, connection refused" failure that costs an hour later.
Image pulldocker pull starrocks/allin1-ubuntu:<pinned-tag> and docker pull mysql:8.0.46. Read RepoDigests from docker image inspect and paste the digest into compose. Pulling happens early because it is the slowest, most network-dependent step.
Runtime inside the imageOne throwaway container: confirm AVX2 in /proc/cpuinfo, java -version at 17 or above, and that the entrypoint starts. Then remove it. This is where the official requirements become measured facts.
Offline fallbackIf the registry throttles or the network blocks: authenticated pull, a mirror, or docker save / docker load from another machine. A saved tar with a recorded digest is the reproducible escape hatch.
Disk headroomdocker system df: the WSL2 virtual disk must hold both images plus volumes. The size is read from that command, never estimated, and recorded next to the digests.
Gateboth images present locally with digests recorded, ports free, AVX2 and JDK ≥ 17 confirmed inside the image. Met: allin1-ubuntu:3.5.21 @ sha256:faf5f6b1…8b2a (5.18 GB) · mysql:8.0.46 @ sha256:7dcddc01…ae2b (1.1 GB). Pinning them in the compose file happens in Phase 3. Report →
PHASE 2 Subset design and verification 100 % · complete · 0.5 d   Phase 2 report →
BudgetContainer memory cap: 4 GB. From that: raw CSV ≤ 3 GB and compressed footprint in StarRocks ≤ 1.5 GB. The subset is sized by memory, never by disk.
Strategy AYear slicing. Rejected on measurement: a single recent SECOP II year is 935 k–1.04 M rows (≈2.2–2.5 GB of CSV), and 2023 alone is 841 k (≈2.0 GB). One year plus any SECOP I slice breaks the 3 GB ceiling.
Strategy BDeterministic modulo sampling on the identifier (CRC32(pk) % k = 0). Reproducible, parallelisable, no ORDER BY, preserves the mix of entities and years. Selected with k = 13.
Export specFrozen in sql/03_export_spec.sql: the two canonical SELECTs, the year derivation (declared year → parsed date → 0), the column mapping to the unified table, and the four checks that must run with the export. Hash uniformity verified: 7.72 % on a 200 k-row sample against 7.69 % expected.
Size result855,452 + 452,877 = 1,308,329 rows, ≈2.7 GB CSV. Expected matches: 51,338 / 5,457 / 1,837 against thresholds of 50,000 / 5,000 / 1,500.
VerificationRecompute the three counts on the exported subset; compare against the expected fraction (±1 %); record total rows, byte size and null counts on key columns. Subset figures go on page one of the report.
IntegrityExport from a consistent snapshot (single read transaction) so rows cannot shift mid-export; checksum or block hash to compare export against load.
Gatea decision table with rows, GB, the three counts and the applied fraction — approved by the reviewer. Signed off by the reviewer on 2026-11-25. The table, the frozen export spec and the uniformity test; see §11 of the Phase 0 report. Report →
PHASE 3 Compose, DDL and the partition test 100 % · complete · 0.5 d   Phase 3 report →
docker-compose.ymlstarrocks/allin1-ubuntu pinned by tag and the digest captured in Phase 1; explicit mem_limit/deploy.resources (4 GB), capped cpus, ports 9030/8030/8040 bound to loopback, named volume, FE healthcheck. MySQL 8.0.46 as a second service under the same memory cap.
ddl.sqlDUPLICATE KEY justified (append-only fact table, no write-time dedup); year partitioning; buckets sized per partition volume; replication_num = 1 because there is a single BE; an explicit unknown-year partition, because 1.58 M source rows have no date.
Partition testMeasured on 3.5.21: expression partitioning works — PARTITION BY date_trunc('year', ts) created p2023 and p2024 on demand. It was still rejected: 1.58 M source rows have no date, and a date expression would have to invent one. The DDL uses RANGE(anio) with an explicit p_unknown. Second finding: RANGE bounds must be quoted (LESS THAN ("2004")) even for an INT column.
Boot verificationBoth services healthy, SELECT 1 on 9030, MySQL up, and the FE/BE versions recorded from the running containers — not from the tag name.
Gate metdocker compose up -d left both engines healthy in 40 s; SELECT 1 answers on 9030; StarRocks reports 3.5.21-85fccf8 with BE 10001 alive; MySQL reports 8.0.46 with a 1 GB buffer pool; the DDL applied clean and created 25 partitions. Pruning cannot be demonstrated yet — the table is empty, so the optimiser short-circuits to EMPTYSET; it is verified after the load. Report →
PHASE 4 Export and load 100 % · complete · 1 d   Phase 4 report →
export.shExtract the subset to CSV/TSV with the same predicate on both tables, no ORDER BY, --single-transaction and --quick; verify the count at source on the same predicate and abort if it does not match the lines written. Compression in the pipe: ≈3 GB is 0,03 % of the OCI 10 TB monthly egress allowance, so transfer cost is zero — the reason to compress is time, not money.
load.shStream Load over HTTP (8030) with Expect: 100-continue; mandatory check of NumberLoadedRows vs NumberFilteredRows and ErrorURL when rows are rejected; the script fails if filtered rows are not zero. Load errors are read from the BE (8040).
RetriesIdempotency via a stable load label, so a retry cannot duplicate rows.
Second loadThe same CSVs into the MySQL 8.0.46 service with LOAD DATA INFILE, so both engines hold exactly the same content.
Gate metCOUNT(*) is 1,309,594 on both engines and 1,309,594 lines in the CSVs; NumberFilteredRows is 0 on both loads (19.1 s + 7.1 s); the three reference counts land at +0.40 %, −0.24 % and +0.60 % of expected; EXPLAIN opens partitions=1/25. MySQL loaded in 379 s. Two semantics traps were caught here and are recorded: StarRocks compares byte-exact while MySQL uses ai_ci, so every Phase 5 query is ASCII-only and wrapped in LOWER(). Full evidence in sql/06_f4_verification.out.txt. Report →
PHASE 5 Benchmark and query profiles 100 % · complete · 1 d   Phase 5 report →
queries/Four queries in identical SQL for both engines, no proprietary functions; one native text variant (annex) explicitly marked as non-comparable in the main table.
bench.shPer query: 2 discarded warm-up runs, 5 measured runs, median and p95, CSV output with engine, query, run, ms, rows returned and a result checksum proving both engines return the same thing.
Query profileKeep the StarRocks profile for Q1 and Q4 (bytes read, time per operator, partition pruning) and EXPLAIN ANALYZE from MySQL. This is the evidence behind "why".
LossesDocument Q2-native and Q3 with their cause: InnoDB's inverted index and clustered primary-key access versus planning overhead and the absence of a point index in StarRocks.
Gatecomplete CSV, identical results across engines, at least one stored profile per query.
PHASE 6 Technical report · 12 blocks · 10 charts 100 % · complete · 1.5 d   Phase 6 report →

Question · environment · modelling · loading · methodology · results · where it loses · query profile · validity · conclusion. Subset size and recomputed counts open the document. Every number comes from the benchmark CSV; estimates are labelled as estimates.

Gateno performance claim without a CSV row behind it; a "where it loses" section with at least two cases and their mechanism.
PHASE 7 Six-minute video script 0 % · waiting · 0.5 d

A script with per-block timestamps, written to be recorded in one take with the terminal visible at the moment the result lands: what gets typed, what appears on screen, and what is said while it runs. It needs a timed rehearsal and a prepared terminal — large font, short prompt, clean history, plus a pre-generated benchmark output as fallback if a query runs long.

Gatea full rehearsal under 6:00 without reading the script off-screen.
PHASE 8 Dashboard API · Spring Boot 100 % · complete · 0.75 d   Phase 8 report →   Architecture →
Why a tier is mandatoryThe browser cannot query StarRocks: the engine speaks the binary MySQL protocol on 9030, and the FE's HTTP shortcut /api/query answers 501 Not Implemented on 3.5.21 — measured, not assumed. So the dashboard needs one server in between.
RuntimeJava 17 + Spring Boot 3, Maven wrapper, port 8080. No ORM: four aggregate queries through JdbcTemplate, mapped to records. An object graph would only get in the way of a GROUP BY.
Read pathMySQL Connector/J against the FE on 9030, the same protocol the benchmark used. Never the 8030 endpoint.
EndpointsGET /api/v1/consolidados/por-anio, /por-entidad, /por-departamento, /texto. Year range and row limit as parameters. JSON envelope: data, generatedAt, source, rows.
Freshness modelNo polling and no scheduled refresh — a reviewer decision, not an omission. Each request asks the engine; the heaviest consolidation measured 334 ms, so the answer is already interactive. An optional 60 s cache sits in front, and ?refresh=true bypasses it.
Why no materialised viewAt 334 ms a pre-aggregated copy buys no user-visible time and adds a staleness window. It stays a documented option for the day a consolidation crosses ~2 s, and this report records the threshold.
CredentialsA read-only user with SELECT on secop, injected as SR_URL / SR_USER / SR_PASSWORD. Never root, never in the repository, and the app refuses to start if they are missing.
Failure shape503 with a JSON body naming the engine and the reason. The frontend is expected to render it, so it is part of the contract and not an afterthought.
Contract firstOpenAPI plus one golden JSON per endpoint committed to the repo, so Phase 9 can be built and reviewed before the API exists.
CORSOnly http://localhost:5173. The engine stays on loopback and is never exposed.
Gateall four endpoints return numbers that match a manual query on 9030; the app boots with no credential in the repository; with StarRocks stopped it answers 503 with a readable body instead of a stack trace.
PHASE 9 Dashboard · React + Vite 100 % · complete · 0.75 d   Phase 9 report →
ScaffoldVite + React 18 + TypeScript on 5173. No meta-framework: the deliverable is one page, and a router or SSR would add surface without adding an answer.
PanelsFour KPIs (rows, total value, entities, contracts with text) and three charts: value by year, top entities, value by department, plus the text-search volume as a table. Same palette as the phase reports so the page reads as part of the same document set.
Data layerTanStack Query with staleTime: 5 min and refetchOnWindowFocus: false. No refetchInterval: a single "Actualizar" button is the only thing that changes a number, which is what "no refreshing" was asked to mean.
Builds without a backendDeveloped against the golden JSON fixtures of Phase 8, so the page runs with the API stopped and the contract is exercised from both sides.
StatesLoading skeleton, empty result, and an error panel that names the API and the engine. An empty chart is not an error message.
LayoutReadable at 1280 px, keyboard navigable, no colour-only encoding, and charts that degrade to a table when JavaScript is off.
Buildnpm run build to dist/, servable by any static server. No environment variables baked in beyond the API base URL.
Gatethe four panels match the API payload exactly; the refresh button is the only trigger; with the API down the page shows the error panel, not an empty chart.
PHASE 10 Packaging and close 0 % · waiting · 0.25 d
ComposeTwo services next to the engines: dashboard-api (Spring Boot jar, 8080) and dashboard-web (nginx serving dist/, 5173), with healthchecks and depends_on so the API waits for the FE instead of crash-looping.
One commanddocker compose up -d brings up engines, API and dashboard together; down leaves nothing running and no volume behind.
READMEClone to dashboard in four commands, plus what to do when 9030 is occupied on the host.
CloseScreenshots of the three states (loaded, empty, API down) and the phase's own report page, linked from the board like every other phase.
Gatefrom a clean shell, four commands end with the dashboard answering on localhost:5173 with numbers that match 9030.
PHASE 11 Dashboard v2 · 22 charts, five tabs 100 % · complete · 1.5 d   Phase 11 report →
ScopeDouble the visual surface: 22 charts and 5 tables, up from 10 and 1. Five tabs — Overview, Time & money, Geography, Suppliers, Text & records.
The cheap halfTen of the new charts needed no backend: every aggregation already returned a count and a value, and the page was drawing one of the two.
The expensive halfSeven new endpoints: median per year (percentile_approx), weekday, year × month, buyer distribution, legal representatives, and a paginated contract table. The two heaviest measured 74 ms together.
Why tabsEach tab enables only its own queries, so the first paint makes 3 requests instead of 17. One global Year lives in the header — two selectors that mirrored each other were worse than one that says so.
QATwelve rendering defects found by looking at the page, twelve fixed: axes formatted as pesos for counts, colliding donut labels, four-line wrapped categories, rounding collisions in ticks, unordered bands, undercounted tab badges.
Gate met22 of 22 canvases paint across the five tabs, pagination verified page 1 → 2 over 71,901 contracts, the year filter repaints chart and table together, zero console messages, tsc --noEmit clean.

5 Subset: proposal, justification, verification

The delicate part. A badly chosen subset produces a benchmark that measures the subset, not the engine.

Memory budget → data ceiling

With a 4 GB container the BE cannot afford a working set of tens of gigabytes: page cache becomes the bottleneck and scan queries start hitting disk unpredictably. Hence the ceiling: raw CSV ≤ 3 GB and compressed footprint in StarRocks ≤ 1.5 GB. The budget is set by memory because disk (168.6 GB free on E:) is not the constraint.

Sizing from the verified figures

TableRowsPayloadBytes/rowReading
secop_i_records11,120,87721.89 GB≈ 1.97 KB85 columns; 4 FULLTEXT indexes inflate the file, not the CSV.
secop_ii_registros5,887,39613.97 GB≈ 2.37 KB96 columns, 7 FULLTEXT. The heaviest table per row.
Both tables17,008,27335.86 GB≈ 2.11 KBFiles on disk are 43.1 GB because FULLTEXT lives in separate fts_*.ibd.

At ~2 KB per row, a 3 GB CSV ceiling implies roughly 1.3–1.5 million rows. The exact value is fixed by measurement: k = 13 lands at 1,308,329 rows and ≈2.7 GB, with a 10 % margin under the cap.

Strategy A — year slicing rejected

Two full SECOP II years and one SECOP I year.

  • Why it would be nice: the DDL partitioning would drive the sample, and pruning would show up in the profile.
  • Why it fails: a single recent year is 935 k–1.04 M rows, ≈2.2–2.5 GB of CSV. 2023 alone is 841 k rows (≈2.0 GB). One year plus any meaningful SECOP I slice exceeds 3 GB.
  • Half-year windows would fit, but they add within-year seasonality, and on SECOP I the date is free text — a range filter there cannot be trusted.

Strategy B — deterministic sampling selected · k = 13

CRC32(UID) % 13 = 0 and CRC32(id_contrato) % 13 = 0.

  • Reproducible: same seed and same k reproduce the export byte-for-byte.
  • Representative: preserves the year, entity and value mix without any ORDER BY.
  • Cost accepted: the sample is uniform, not date-based, so the year partitions are a modelling choice and pruning is demonstrated with a filtered query. The partition key does not select the sample.

Size rule (all conditions, or resize)

Text is the scarce resource: with ~0.2 % match density for computadores, a subset that is too small leaves the text query measuring noise. Thresholds derive from the three validated counts:

MetricSource (verified)Expected at k = 13Minimum required
bogota in Nombre_de_la_Entidad (SECOP I)667,388≈ 51,338≥ 50,000
bogota in nombre_entidad (SECOP II)70,941≈ 5,457≥ 5,000
computadores in Detalle_del_Objeto_a_Contratar23,883≈ 1,837≥ 1,500
Total rows in the subset17,008,273≈ 1,308,329≥ 1.2 M and CSV ≤ 3 GB

The middle column is arithmetic on the validated counts at a 13th fraction — an estimate until the export runs. Real values replace it in the report.

Verification method (five checks, in order)

  1. Source count: COUNT(*) with the exact export predicate, before writing the file.
  2. Exported line count: compare against the source count; any difference aborts the export.
  3. Recompute the three counts on the subset and compare with the applied fraction (±1 %).
  4. Count after load on StarRocks and MySQL: the three numbers must agree across engines and with the CSV.
  5. Null profile and lengths: nulls on key columns and max length of text fields, to rule out truncation that would alter search results.
Contract with the reader

Page one of the report declares: total subset rows, CSV gigabytes, fraction of the original base, and the three recomputed counts next to the reference ones. If the subset is trimmed relative to this proposal, the difference is explained, not smoothed over.

6 The four queries and their hypotheses

Two where StarRocks is expected to dominate and two where it is expected to lose. That balance is the experiment design, and it is deliberate.

Q1 Aggregation by entity and year hypothesis: StarRocks · 20–100×
-- identical on both engines
SELECT entidad, anio, COUNT(*) AS n, SUM(valor_num) AS total
FROM   contratos
GROUP BY entidad, anio
ORDER BY total DESC
LIMIT  50;

What it measures: column scan + high-cardinality aggregation + sort. Why StarRocks should win: reads only the columns involved, vectorises the aggregation and never touches whole rows; MySQL walks 16 KB pages row by row. Bias risk: none from parsing — the value is double on both sides, so no cleaning cost can creep in. The outlier recorded in Phase 0 applies equally to both engines.

Q2 Text search in the contract object hypothesis: MySQL (native) · required loss
-- Q2a: identical form, comparable
SELECT COUNT(*) FROM contratos
WHERE  detalle_objeto LIKE '%computadores%';

Q2a (identical): LIKE '%…%' cannot use a FULLTEXT index in MySQL — it means a full row-by-row scan. Here StarRocks usually ties or wins, and that result is reported as it is.

-- Q2b: native form per engine (annex, NOT identical)
-- MySQL:     MATCH(detalle_objeto) AGAINST ('computadores' IN BOOLEAN MODE)
-- StarRocks: inverted index + MATCH_* on the same column

Q2b (native): where MySQL wins clearly, because the 4 FULLTEXT indexes exist precisely for it and answer without reading the table. StarRocks has no equivalent FULLTEXT semantics; its inverted index is a different thing and must be verified on the pinned version. Reporting rule: Q2b sits in a separate table, labelled as a non-identical comparison, and stays out of the main results.

Measured justification: the same question returns 23,372 (FULLTEXT), 23,883 (LIKE) and 5,358 (LIKE BINARY). Mixing operators would let either engine win by changing the question.

Q3 Point lookup by identifier hypothesis: MySQL · 10–50×
-- identical on both engines · same id across the 5 runs
SELECT * FROM contratos WHERE id_contrato = ?;

What it measures: latency to fetch one full row by key, planning cost included. Why MySQL should win: InnoDB stores the row inside a clustered tree keyed by primary key — three or four page levels and the row is in memory. StarRocks carries planning overhead and pays for scattered column access. How it is measured honestly: same identifier, 5 runs, and the p95 is reported because the tail is the pain here. A low scanned-rows ceiling is enforced so the query cannot degrade into a scan.

Q4 Top-N with join and high cardinality hypothesis: StarRocks · 10–50×
-- identical on both engines
SELECT c.nit, c.razon_social, COUNT(*) n, SUM(c.valor_num) total
FROM   contratos c JOIN entidades e ON c.codigo_entidad = e.codigo
WHERE  c.anio >= ?
GROUP BY c.nit, c.razon_social
HAVING COUNT(*) > 1
ORDER BY total DESC
LIMIT  100;

What it measures: join + high-cardinality aggregation + filter + top-N. Why StarRocks should win: distributed hash join, vectorised, with a LIMIT that cuts before materialising. Bias risk: if the optimiser picks a different plan than expected, the profile exposes it; the report shows the plan that actually ran.

On "identical"

All four queries use standard SQL, no proprietary functions, the same columns and the same result ordering. Any mandatory syntax difference (date handling, for instance) is isolated in a view or a computed column created identically on both engines, and documented. The single declared exception is Q2b.

7 Measurement methodology

DecisionRule
Repetitions2 warm-up runs per query and engine, discarded; then 5 measured runs.
StatisticMedian and p95. Never the best time. With five points, p95 is reported as the observed maximum and labelled as such — not dressed up as a robust percentile.
Cache stateWarm on both engines, with explicit and identical warm-up before measuring. The cold first read is measured separately as an annex and excluded from the main table.
Resource symmetryBoth engines under the same RAM and CPU cap in compose. A 4 GB container against an unthrottled server proves nothing.
ClientA single client (the mysql container), no connection reused across engines, timing taken with a monotonic clock rather than the shell's time.
Engine result cacheCheck and disable any query result cache before measuring; the exact parameter name is recorded when the check is performed, not assumed in advance.
Result equivalenceEach run stores a checksum of its result. If the two engines disagree, the timing is not compared: the query is fixed first.
Evidence of "why"StarRocks query profile (bytes read, time per operator, partition pruning) and MySQL EXPLAIN ANALYZE for Q1 and Q4; for Q2 and Q3, the plan that explains the loss.
RecordCSV columns: engine, query, run, ms, rows returned, result checksum, plus context fields (engine version, date, dataset hash).

The win/tie/loss thresholds in section 1 are fixed before seeing numbers. If they have to change after measuring, the change and its reason are recorded.

Baseline to beat

Phase 0 measured this server at 122 MB/s scanning SECOP I and 87 MB/s scanning SECOP II, with a 3 GB buffer pool. StarRocks runs on a different machine, so the comparison is engine-to-engine on equivalent resource caps — the baseline is context, not the opponent.

8 Deliverables map and acceptance criteria

FilePhaseMinimum contentAcceptance
docker-compose.yml3Pinned version with digest, explicit mem_limit, capped CPUs, ports 9030/8030/8040, volume, healthcheck, symmetric MySQL 8.0.46 service.Boots clean and both engines answer.
ddl.sql3Duplicate Key, year partitioning (plus unknown-year partition), buckets, replication_num = 1, and one comment per decision giving the reason and the discarded alternative.Applies without warnings; comments justify every choice.
export.sh4Single predicate, consistent snapshot, count verification, abort on deviation, gzip in the pipe.Source count = exported lines.
load.sh4Stream Load with idempotent label; compares NumberLoadedRows vs NumberFilteredRows; prints ErrorURL on rejects.Filtered = 0 and count matches the CSV.
docs/phase-N-report.html0–10One report per closed phase: what was measured, what failed, what was decided and the gate that closed it. Shared stylesheet report.css.Linked from the board in three places; every figure traceable to an evidence file.
queries/5Q1, Q2a, Q3, Q4 identical, plus Q2b kept separate and labelled.Run on both engines with identical checksums (except Q2b).
bench.sh52 warm-ups + 5 runs, median and p95, CSV output.Repeatable: two executions agree within 10 % on medians.
INFORME.md612 blocks and 10 charts; subset size on page one; a losses section with mechanism; exact Mann–Whitney with n = 5 disclosed.Every figure traceable to a CSV row.
video.md7Six-minute script with timecodes, single take, terminal visible.Timed rehearsal ≤ 6:00.
dashboard-api/8Spring Boot service exposing eleven consolidations over JDBC to port 9030: read-only user from the environment, golden JSON fixtures, 503 when the engine is down.Numbers match a manual query; boots with no credential in the repo.
dashboard-web/9Vite + React page in English: a four-card SECOP explainer, six KPIs, ten charts, a single manual refresh, explicit error state.Panels match the API payload; refresh is the only trigger.

Not deliverables, but required for an auditable report: schema-notes.md (Phase 0, already written), the Phase 0 report and the benchmark CSV. All three stay in the repo even though they are not presented.

9 Estimated timeline

About seven and a half working days, with Phase 0 already spent. The original 5.8 days grew by 1.75 on 2026-11-25, when the dashboard phases were added. Durations are estimates, not measured commitments. Phase 1 runs in parallel with the tail of Phase 0 and the start of Phase 2, so the image pull never sits on the critical path.

0 · Schema discovery
1 · Docker + image pull
2 · Subset design
3 · Compose + DDL
4 · Export + Load
5 · Benchmark
6 · Report
7 · Video
8 · Dashboard API
9 · Dashboard web
10 · Packaging
D1D2D3D4D5D6D7D8
Critical path

Subset approval → Phase 4 → Phase 5 → Phase 6. Access is no longer on the path: it was the original bottleneck and it is closed. A day lost pulling images still costs nothing, which is why Phase 1 is scheduled early and off the path. Phases 6 and 7 cannot overlap Phase 5: the report is written on closed numbers, the video on a finished report. Phases 8 to 10 sit off that chain — F8 can start in parallel with the video — and are drawn sequentially only so the bar shows the real total.

10 Risks and mitigations

RiskImpactMitigation
StarRocks runs out of memory at 4 GB and the BE diesHigh3 GB CSV ceiling, explicit BE limit, watch logs on 8040, shrink the subset rather than raise memory (raising it would break the reproducibility premise).
Engines return different resultsHighPer-run checksum; on mismatch no timing is reported. Typical causes: collation, or a SUM over text.
Value column has 10.9 % zeros and one 3.64e14 outlierMediumNot cleaned — both engines must see identical data. The report names the outlier so Q1 is not read as a volume win.
Text query lacks critical massMediumMinimum match thresholds in the size rule; k = 13 already clears all three.
1.58 M rows have no yearMediumExplicit unknown-year partition in the DDL; otherwise date-filtered queries quietly drop 9 % of the corpus.
Expression partitioning unsupported on the pinned buildClosedRefuted: date_trunc('year', …) works on 3.5.21. RANGE is used for a different reason — 1.58 M rows without a date.
Image pull blocked, throttled, or silently re-taggedMediumPulled in Phase 1, out of the critical path, with digests recorded. Fallback: authenticated pull, mirror, or docker save/docker load. A moved tag is caught because compose pins the digest, not the name.
Source statistics mislead a later stepLowTABLE_ROWS is off by two orders of magnitude on this schema; every step uses COUNT(*), and the DDL comments say so.
Bias from asymmetric resourcesMediumIdentical RAM/CPU limits in compose, declared in the report.
Video overruns six minutesLowTimed rehearsal, prepared terminal, predictable benchmark output and a pre-generated fallback.

11 Decisions taken and still pending

DecisionStatusNote
Report first, video secondClosedThe video consumes closed figures; never the other way round.
Include losses: text and point lookupClosedQ2 and Q3 exist for this. Without them the report is worthless.
Single take, terminal visibleClosedConstrains the script: everything shown must fit in real time.
Single BE ⇒ replication_num = 1ClosedExplained in the DDL as a consequence of the environment, not as a production recommendation.
Read-only access over SSH + socketClosedB1 resolved; port 3306 stays closed to the internet.
Value column is numericClosedB3 resolved by measurement: double, no separators.
Modulo sampling instead of year slicingClosedk = 13 approved; landed at 1,309,594 rows, 0.69 GB.
Exact StarRocks versionClosed3.5.21-85fccf8, pinned by digest in the compose file.
Queries must be collation-neutralClosedStarRocks compares byte-exact, MySQL defaults to ai_ci: the same LIKE '%bogota%' returns 0 and 51,545. Every query is ASCII-only and wrapped in LOWER(), otherwise the benchmark measures collation, not the engine.
Dashboard backend in Java Spring BootClosedChosen by the reviewer. JDBC to the FE on 9030; the HTTP shortcut /api/query answers 501 on 3.5.21, so no framework could have avoided the API tier anyway.
No automatic refresh anywhereClosedDecided 2026-11-25: no MV schedule, no UI polling. Each request reads the engine (334 ms measured for the heaviest consolidation); the only refresh is the user pressing the button.
Distinct counts are not comparableClosedCOUNT(DISTINCT entidad) gives 13,270 vs 13,252 on identical rows, because ai_ci merges accented variants. Any such query is labelled non-comparable rather than reported as a difference.

12 Start checklist

What had to exist before the first line of lab code — and what already does.

  • Agree the access route to 129.80.141.192.B1 · done
  • Obtain a read-only session and verify effective access.B1 · done
  • Run schema discovery and save schema-notes.md.Phase 0 · done
  • Recompute the three reference counts on the full source.Phase 0 · done
  • Confirm RAM and disk assigned to Docker Desktop (24.89 GB / 168.6 GB free on E:).measured
  • Approve the subset decision table (k = 13) before exporting.approved
  • Pin the tag and digest of starrocks/allin1-ubuntu → 3.5.21.done
  • Provision Docker: engine and compose v2 respond, resource cap in .wslconfig, ports free.done
  • Pull both images and record their RepoDigests in the compose file.done
  • Confirm AVX2 and JDK ≥ 17 inside the image at first boot → AVX2 + AVX-512, OpenJDK 17.0.20.done

Next actions

#ActionOwnerBlocking
1Approve subset k = 13 (or request a different size)ReviewerDone
2Pin StarRocks tag + digest in composeLabDone
3Verify Docker engine, resource cap, free portsLabDone
4Pull both images, confirm AVX2 + JDK 17 insideLabDone
5Write compose + DDL, run the partition testLabDone
6Approve the dashboard scope: four consolidations, no auto-refreshReviewerDone
7Choose the dashboard backendReviewerDone · Spring Boot
8Create a SELECT-only StarRocks user for the APIReviewerDone · secop_reader
State at 2026-11-25

All eight actions are closed. The read-only user exists (secop_reader) and the API connects as it. The open one is operational: the lab has no user other than root without a password, and the plan forbids the dashboard API from running as root, so a SELECT-only user has to exist before Phase 8 can be called done. Everything else — subset, images, DDL, export, benchmark, report and the dashboard scope — is decided and measured.