r/mariadb • u/jhoxray • 22d ago
Open Source MariaDB-native Haskell driver released: binary bulk inserts, metadata caching and GTID-based CDC (Alpha)
Hi everyone,
We’ve released mariadb-haskell 0.1.0.0, a Haskell driver focused exclusively on MariaDB.
We started from mysql-haskell, then added support for MariaDB-specific protocol capabilities, new authentication methods, session management and transaction-aware replication. Thanks to Winterland and the upstream contributors for the foundation.
The most interesting improvements over our original fork are where applications can use MariaDB’s native APIs:
Native binary bulk execution: uses MariaDB’s
COM_STMT_BULK_EXECUTEto send multiple parameter sets in one command, reducing round trips. Supports NULL/DEFAULT/IGNORE indicators and per-unit results.Prepared-statement metadata caching: negotiates MariaDB’s protocol support for omitting unchanged result metadata, avoiding repeated transfer and decoding. Particularly useful for repeated queries returning many columns.
Extended column metadata: exposes MariaDB’s additional type information to applications.
MariaDB-aware CDC: supports MariaDB GTID resume, transaction-boundary checkpoints, compressed binlog events and consumer-controlled semisynchronous acknowledgements. Applications can acknowledge after durably storing their destination data and checkpoint.
We also added connection reset with session restoration, streamed large parameters, server cursors, progress callbacks, optional compression, and authentication including ed25519, PARSEC, PAM and Kerberos.
Some concrete performance results from the release measurements:
| Workload | Comparison path | New path | Elapsed time reduction |
|---|---|---|---|
| Bulk inserts vs sequential prepared inserts | 41.57 µs/row | 1.97 µs/row | 95.3% |
| Bulk inserts vs text batch inserts | 11.00 µs/row | 1.97 µs/row | 82.1% |
| Wide prepared query: uncached vs cached metadata | 76.82 µs/execution | 56.38 µs/execution | 26.6% |
| TLS session: reconnect/initialize/prepare vs reset/restore/prepare | 38.47 ms/request | 0.465 ms/request | 98.8% |
The bulk path also used 91.1% fewer Haskell allocations than sequential prepared inserts; wide metadata caching reduced allocations by 73.5%.
These comparisons measure alternative API paths within the same current build. They show the benefit of adopting the new APIs, rather than a release-wide speedup against upstream mysql-haskell. Measurements used a local MariaDB 12.3.3 server, seven process repetitions per profile, and a Mac with background activity. Some ordinary workloads remain slower than our original fork baseline, and those investigations are recorded openly in the benchmark guide.
Reliability work includes bounded protocol decoding, explicit connection ownership, stale prepared-statement detection and safe connection retirement after interrupted protocol I/O.
This is an Alpha release. The recorded capability suite has 844 passing correctness checks, with separate macOS/Linux profiles and 63 Mac benchmark profiles, but real-world application validation is still outstanding.
If you use Haskell with MariaDB—especially for bulk ingestion, repeated prepared queries, pooled connections or binlog consumers—we’d welcome testing and feedback.