Wednesday, February 1, 2012

What is MySQL Storage Engine ?

Storage engine is a (pluggable) module in MySQL Server which primarily handles the storage layout, reading and writing of the data associated with database tables. MySQL supports different storage engines for different tables.

Why this abstraction useful, if at all? For one thing, it allows familiar SQL interface irrespective of the storage mechanism. Imagine if you could access the contents of a CSV (comma separated values) file using SQL interface? The MySQL CSV Storage engine does exactly that. Storing in CSV is not the most efficient way to organize data for querying purpose, but you can clearly see the benefit of having a storage engine to leverage SQL interface capabilities. MySQL also enables connectivity from almost any popular programming language or platforms -- like C, PHP, Java/JDBC, Perl, etc.

MyISAM and Memory storage engines (introduced in version 3.23.0) were two of the initial popular storage engines which does not support transactional tables. InnoDB storage engine which supports transaction and row level locking was introduced in later versions of MySQL 3.23. InnoDB is the default engine as of MySQL version 5.5.5.

There is also a separate storage engine for cluster which is called NDB. MySQL cluster supports highly available, automatic-failover supported installations mainly used in domains such as telecom.

Note that the query optimizer is largely outside the scope of storage engine as per the existing design. There is lot of scope for improvement in this area where storage engine can help better with query optimizations, but that requires extensions in APIs between core MySQL server and storage engines.

For some gory details of storage engine internals, you can look here:

http://forge.mysql.com/wiki/MySQL_Internals_Custom_Engine

See Also:

Monday, January 30, 2012

What is MySQL ?

MySQL is a open source relational database management system (RDBMS). It is the most popular choice of database used in web applications. MySQL is currently owned by Oracle corporation.

It is core part of LAMP web application software stack. LAMP is an acronym for "Linux, Apache, MySQL, Perl/PHP/Python". MySQL is available and tested on almost all popular operating systems. It is possible to access MySQL from most popular languages/platforms. For example, PHP support for mysql, JDBC driver for Java, mysql client library for use with C programs, ODBC driver, and many others. It is also relatively easier to install and manage MySQL compared to most other RDBMS systems (such as Oracle). The features are well documented. These factors are central to it's widespread adoption.

MySQL is written in C and C++. The most distinguishing feature of MySQL is the support for "Storage Engines". User can choose a specific storage engine for a table. More details about storage engines will be available in another separate post.

See Also: