# [RNBK|INFR] DB engine comparison — MySQL vs PostgreSQL vs MariaDB (live-schema measurements)
AI Summary
Purpose:
- Preserve the 2026-07-09 read-only live-schema measurement study (DAT-3313/3314)
comparing three engines around partitioning, authored by 김현욱.
Key points:
- Measured facts across 4 instances (수집/dist-main/dist-source/prod):
partitioning = 0 tables anywhere; largest tables are billions of rows as single tables — e.g. TB_COMP_FILE_MAP_RAW_V6 6.67B rows/914GB, TB_COMP_FILE_MAP_V6_1 3.4B rows/879GB with INDEX 701GB > DATA 178GB.
- Root cause of index bloat identified: InnoDB secondary indexes embed the wide
composite PK (e.g. 4-column string PK on TB_COMP_LIB_VERSION), so every secondary index carries it. PostgreSQL uses a 6-byte ctid instead.
- Partitioning comparison: MySQL/MariaDB lose FK support entirely on partitioned
tables; PostgreSQL keeps FK (11+), has pg_partman/pg_cron automation, BRIN for append-only maps, and DETACH PARTITION CONCURRENTLY for non-blocking purge. Common constraint all three: partition key must be in every unique key/PK — our biggest table's PK(MAP_ID) and UN(OSS_ID,TAG_ID,FILE_ID) share no column, so key redesign precedes any partitioning regardless of engine.
- Honest counter-case documented: PostgreSQL costs = VACUUM/bloat ops, heap (no
clustered PK), code migration ≈ 2-3 weeks (FULLTEXT 8 spots, 58 views, JSON operators) + 3TB data move; MariaDB is a near-zero "scheme swap" for the license problem.
- Framing: if license policy is only Oracle/CE avoidance → MariaDB is minimal
cost; if GPL is fully banned or structural improvement is an agenda → PostgreSQL port brings timestamptz/jsonb/pg_trgm/BRIN as by-products.
Relevant when:
- Any MySQL→MariaDB/PostgreSQL migration discussion; resume/interview material
("billions-of-rows single tables, index-larger-than-data root cause, 2038").
Do not read full document unless:
- You need the full per-table size table or per-axis engine matrix — open origin.
Linked documents:
- Sister doc (code coupling detail): Confluence DT/4165500930
- ai/sources/confluence/2026-07-17-mariadb-transition-plan.md
Open Questions
- Engine decision pending license policy confirmation (A/B vs C).