« MySQL 5.0 Query Optimizer | Main | MySQL Conference Wrap Up »

April 21, 2005

Writing a Storage Engine for MySQL

Listening to Brian Aker talk about writing a storage engine for MySQL at MySQL 2005.

The CSV and BDB storage engines provide good examples for doing this. Look at the source files and copy the methods. There is also a lot of information on the MySQL site for how to work through this process. You might start with the example engine.


/sql is for the kernel. mysys/ is the portable runtime, should make use of it to make your storage engine portable. mysql-test is the Q/A test suite. If writing code in the server, write test cases.


storage engine - code that stores data handler - code that controls the storage engine

Has anyone does this?

Friendster Google Yahoo

Brian knows of ~25 storage engines.

DDL->Query Cache->Parser->Rewrite->Optimizer->Handler->Engine

Side note: In 5.1 MySQL is moving away from the text-based logs (slow query log, query log and error log) and using the CSV storage engine to create data files that are readable.

Another side note, timestamps are handled in the storage engine, not in the MySQL server.

In looking at a piece of code Brian takes a jab at "another open source database" because they use sscanf() and snprintf(). MySQL wouldn't because it doesn't perform.

Brian suggests that MySQL will be moving to a more modular design, where modules can be integrated in a more Apache-like way.

Posted by mike at April 21, 2005 4:34 PM