ARCHIVE

The ARCHIVE storage engine produces special-purpose tables that store large amounts of unindexed data in a very small footprint. Rows are compressed as they are inserted, and uncompressed on the fly when retrieved. See Storage Engines for how it compares to the others.

ARCHIVE supports INSERT and SELECT, but not DELETE, REPLACE, or UPDATE – making it suitable for logging or audit-trail data that is written once and never modified. It supports ORDER BY operations, BLOB columns, and essentially all data types except spatial ones. It uses row-level locking, and supports the AUTO_INCREMENT column attribute.

FeatureARCHIVE
Storage limitsNone
TransactionsNo
Locking granularityRow
MVCCNo
Geospatial data type supportNo
Geospatial indexing supportNo
B-tree indexesNo
T-tree indexesNo
Hash indexesNo
Full-text search indexesNo
Clustered indexesNo
Data cachesNo
Index cachesNo
Compressed dataYes
Encrypted dataYes
Cluster database supportNo
Replication supportYes
Foreign key supportNo
Backup / point-in-time recoveryYes
Query cache supportYes
Update statistics for data dictionaryYes

CREATE TABLE access_log (
    id INT AUTO_INCREMENT PRIMARY KEY,
    request_path VARCHAR(255),
    logged_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE = ARCHIVE;

INSERT INTO access_log (request_path) VALUES ('/index.html'), ('/api/orders');

-- SELECT and ORDER BY are supported; UPDATE/DELETE/REPLACE are not
SELECT * FROM access_log ORDER BY logged_at DESC;

-- UPDATE access_log SET request_path = '/home' WHERE id = 1; -- rejected