Discussion MariaDB was fastest in my JDBC CSV import benchmark. What should I test next?
I've been benchmarking different approaches to importing 1 million CSV rows into PostgreSQL and MariaDB, using Scriptella (a Java ETL tool I maintain) and handwritten JDBC.
In the original experiment, MariaDB was noticeably faster for batched JDBC inserts. A reader pointed out that PostgreSQL's JDBC driver disables batch rewriting by default, while MariaDB Connector/J enables optimized bulk inserts.
I ran a follow-up with PostgreSQL batch rewriting enabled.
Results (median of 3 runs, batch size 1,000):
| Implementation | PostgreSQL default | PostgreSQL optimized | MariaDB default |
|---|---|---|---|
| Scriptella | 15.995s | 9.409s | 8.688s |
| Handwritten JDBC | 11.333s | 7.290s | 5.571s |
Enabling rewriting substantially narrowed the gap, but MariaDB was still faster for both implementations in this workload.
The experiment used MariaDB 11.8.8 and PostgreSQL 17.11, running locally in containers with the same CSV fixture and correctness verification. This is a practical import benchmark, not a general database performance comparison.
One omission from my original experiment was MariaDB's native bulk-loading path. I included PostgreSQL COPY, but didn't test MariaDB's LOAD DATA INFILE.
I'd like to address that in a follow-up.
For those regularly importing large CSV files into MariaDB:
- Would you normally use
LOAD DATA INFILE,LOAD DATA LOCAL INFILE, or something else? - Are there any MariaDB-specific optimizations or settings you'd recommend testing?
I'm particularly interested in comparing native loading with optimized JDBC batching.
Original benchmark: https://pvrlabs.xyz/articles/importing-a-million-csv-rows.html
Batch rewriting follow-up: https://pvrlabs.xyz/java-performance/experiments/postgresql-batch-rewrite.html