An Entrepreneur, Coach, IT Consultant, Strategic Adviser, and a Traveler craving to explore and contribute to forming a better society.

Thursday, December 4, 2008

Blackhole - MySQL Storage Engine (Updated Version 2.0)

No comments :
Keywords: LAMP, MySQL, Blackhole, Storage Engines, MySQL Storage Engines, short-term-data-loss engine, /dev/null engine, Throw Away Engine

Blackhole - MySQL Storage Engine:

The mantra of Blackhole Engine is, Execute ---> Throw Away ---> Forget What Happend; It shall also be called as short-term-data-loss engine.

In a technical nutshell "Black hole" is a "/dev/null" storage engine (anything you write to it disappears)

Confused? The BLACKHOLE storage engine acts as a “black hole” that accepts data but throws it away and does not store it. The blackhole storage engine is a special storage engine provided by mysql. It actually accepts the query and does nothing hence retrievals always yield empty results.

Also the insert statements will do nothing in case of a "Blackhole" Table Type.

To enable this storage engine if you build MySQL from source, invoke configure with the "--with-blackhole-storage-engine" option. 

To check whether blackhole engine is existing in your Database Server, issue the follwing command:

mysql> SHOW VARIABLES LIKE 'have_blackhole_engine';

mysql> SHOW VARIABLES LIKE 'have_blackhole_engine';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| have_blackhole_engine | NO    |
+-----------------------+-------+
1 row in set (0.00 sec)

The above means that there is no Blackhole Engine available in the Database server. You can enable "Blackhole Engine" using the "--with-blackhole-storage-engine" option

mysql> SHOW VARIABLES LIKE 'have_blackhole_engine';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| have_blackhole_engine | Yes   |
+-----------------------+-------+
1 row in set (0.00 sec)

The above means that there Blackhole Engine available in your Database server. 

If you create a table using "blackhole" engine, it will create only the .frm file associated with the table. No other files are created as it is a throw away engine.

To check the available storage engines, issue the following command:

mysql> show engines;



Usage of Blackhole:

* Shall be used, if you want to check the query syntax alone and dont want to touch the physical records of the mysql engine
* Shall be used, if you want to check the performance of a query using benchmark command


Keywords: LAMP, MySQL, Blackhole, Storage Engines, MySQL Storage Engines, short-term-data-loss engine, /dev/null engine, Throw Away Engine

No comments :