MENU
BLACKHOLE
The BLACKHOLE storage engine accepts data but throws it away – no data is ever stored, and retrievals always return an empty result. See Storage Engines for how it compares to the others.Because writes to a BLACKHOLE table are still recorded in the binary log, it is used as a lightweight relay in some Replication topologies: a server can be configured to write all events through a BLACKHOLE table purely to forward them downstream, without duplicating the data locally. It is also occasionally used to benchmark server overhead independent of storage cost, since writes complete without any actual persistence work.
| Feature | BLACKHOLE |
| Storage limits | 0 (no data is stored) |
| Transactions | No |
| Locking granularity | Table |
| MVCC | No |
| Geospatial data type support | Yes |
| Geospatial indexing support | No |
| B-tree indexes | No |
| T-tree indexes | No |
| Hash indexes | No |
| Full-text search indexes | No |
| Clustered indexes | No |
| Data caches | No |
| Index caches | No |
| Compressed data | No |
| Encrypted data | No |
| Cluster database support | No |
| Replication support | Yes |
| Foreign key support | No |
| Backup / point-in-time recovery | N/A (no data to back up) |
| Query cache support | No |
| Update statistics for data dictionary | No |
CREATE TABLE relay_events (
id INT AUTO_INCREMENT PRIMARY KEY,
payload JSON
) ENGINE = BLACKHOLE;
-- The insert succeeds and is written to the binary log, but no row is stored
INSERT INTO relay_events (payload) VALUES ('{"type":"order_created"}');
SELECT COUNT(*) FROM relay_events; -- always 0Query OK, 1 row affected
| COUNT(*) |
|---|
| 0 |