Chapter 7. The Storage Engine Interface

MySQL provides a layer of abstraction that permits different storage engines to access their tables using the same API. In the past, this interface was called the table handler. More recently, the term storage engine was introduced. In the current terminology, storage engine refers to the code that actually stores and retrieves the data, while table handler refers to the interface between the storage engine and the MySQL optimizer.

The abstract interface greatly facilitates the task of adding another storage engine to MySQL. It was created during the transition from version 3.22 to version 3.23, and it was instrumental in the quick integration of the InnoDB storage engine, which brought in robust transactional capabilities, multi-versioning, and row-level locks. It can be used for integrating custom storage engines, which permits you to quickly develop an SQL interface to just about anything that knows how to read and write records.

The interface is implemented through an abstract class named handler, which provides methods for basic operations such as opening and closing a table, sequentially scanning through the records, retrieving records based on the value of a key, storing a record, and deleting a record. Each storage engine implements a subclass of handler, implementing the interface methods to translate the handler operations into the low-level storage/retrieval API calls of that particular storage engine. Starting in version 5.0, the ...

Get Understanding MySQL Internals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.