Dolt MySQL Differences
Here at DoltHub, we tell users "Dolt is a drop in replacement for MySQL". We're also quick to remind users that "There is no MySQL code in Dolt". Dolt is built from the storage engine up to be MySQL-compatible but also offer Git-style version control, making Dolt the world's first version controlled database.
Since there is no MySQL code in Dolt, it must be a little different right? You are correct. There are a three major differences and a two minor differences that I'll point out in this article. This is not an exhaustive list but should give you a good, general idea on how Dolt is different than MySQL.'
Drop In Replacement
Dolt is a drop in replacement for MySQL. Start a Dolt SQL server and a port opens up that you can connect to with any MySQL client. Import a mysqldump
from your existing MySQL into Dolt to get started. Or run CREATE DATABASE
and CREATE TABLE
SQL statements to set up your database from scratch. Dolt supports all the modern MySQL features you know and love: views, triggers, procedures, collations, events, and full text indexes. Once you set up your database, all the same SELECT
, INSERT
, UPDATE
and DELETE
queries work as expected. In fact, Dolt works so well as a MySQL database that if you find a difference between MySQL and Dolt, we'll fix it in 24 hours or less. If you never use a Dolt feature, Dolt will behave almost exactly like a MySQL database.
We've built sample applications against Dolt with many tools and frameworks using the standard MySQL connector in almost every language. Build a web application backed by Dolt in PHP with Laravel or in Javascript with Knex. Connect Dolt to your favorite data management workflow in Python using SQLAlchemy. Or build a large scale backend service connected to Dolt in Java using Hibernate or in Golang using GORM. It all just works.
Must be slow you say? Nope. Dolt is now only 10% slower than MySQL on a standard suite of sysbench
queries. sysbench
tests simple queries with no concurrency. On the standard high concurrency TPC-C benchmark, MySQL does about 2.5X more transactions per second than Dolt. Dolt is going to perform well for almost all but the largest web-scale applications.
Major Differences
That said, Dolt is different than MySQL in a handful of meaningful ways. The first is version control. Dolt is the first and only SQL database to support full version control of data and schema. Without that difference Dolt probably shouldn't exist...
The other two differences are operational in nature. Dolt creates disk garbage and MySQL does not. Dolt behaves slightly differently under concurrent writes than MySQL.
Version Control
Dolt supports full Git-style version control of data and schema. In SQL, version control read operations like diff
and log
are exposed as system tables or functions. Version control write operations like commit
and branch
are exposed as procedures. When you make your first Dolt commit or branch, Dolt starts to operate as a version controlled database. You have access to a number of features and workflows previously only possible with files.
Disk Garbage
Dolt generates disk garbage because of its storage architecture. MySQL does not generate disk garbage. Dolt handles transactions more like Postgres than MySQL. Postgres also generates garbage. Unlike Postgres, Dolt does not clean up after itself. Occasional calls to dolt_gc()
are required to free disk space.
Automatic garbage collection is under development as I write this and will be released behind a feature flag in the coming weeks. Expect automatic garbage collection to be on by default in Dolt sometime in the first half of 2025.
Speaking of Postgres, you want a Postgres version of Dolt? It exists. It's called Doltgres and it goes Beta sometime this quarter.
Concurrency Behavior
Dolt and MySQL differ under concurrent writes. Both Dolt and MySQL are repeatable read by default. Dolt does not support SELECT FOR UPDATE
for full serializable transactions.
Moreover, under concurrent writes to the same row, Dolt and MySQL will produce different results. MySQL uses locking and queueing to process concurrent writes to the same row. Dolt use the same logic it uses to process merges as it does to detect SQL transaction conflicts. This behavior is surprising and different than MySQL but is fairly easy to reason through once you know about it.
Minor Differences
Along with those three major difference, Dolt also has a couple minor compatibility differences related to information and performance schema. MySQL exposes operational information about its internal workings via these schemas that don't translate well to Dolt. We do the best we can and usually return NULL
when the value does not translate.
Limited Information Schema Support
Dolt partially supports MySQL information schema. A full list of compatibilities is available in our Dolt documentation. As you can see the whole innodb
set of tables is unsupported because Dolt is not an innodb
database. If you need a value we don't support yet, please file an issue.
No Performance Schema
Unlike information schema where Dolt provides best effort support, Dolt does not support MySQL performance schema at all.
Differences Coming Soon
We have a new difference coming soon. This feature is defined in MariaDB but not in MySQL yet: Vector Search.
Vector Search Support
Vectors will launch in Dolt in the next few weeks. Dolt is adopting the MariaDB syntax for vectors. We adopted our Prolly Tree-based storage engine to store and query vectors and vector history efficiently. Dolt will be the only database to support historical vector search. Need to know what this vector search would have returned last week? Dolt will be able provide that result quickly and easily.
Conclusion
Dolt is a drop in replacement for MySQL. Dolt is MySQL-compatible but contains no MySQL code. Thus, there are a few major differences like version control features, disk garbage, and behavior under write concurrency. Curious to learn more? Come by our Discord and ask a question.