FEDERATED

The FEDERATED storage engine accesses data on a remote MySQL server without using replication or cluster technology. No data is stored in the local table; querying a local FEDERATED table transparently pulls the data from the remote (federated) table on demand. See Storage Engines for how it compares to the others.

To enable FEDERATED, the server binary must be started with the --federated option.

FeatureFEDERATED
Storage limitsDepends on the remote table's engine
TransactionsNo
Locking granularityN/A (delegated to the remote server)
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 dataNo
Encrypted dataNo
Cluster database supportNo
Replication supportYes (locally – the remote server replicates independently)
Foreign key supportNo
Backup / point-in-time recoveryNo (back up the remote table on its own server)
Query cache supportNo
Update statistics for data dictionaryNo

-- On the remote server: an ordinary table to expose
CREATE TABLE remote_db.customers (
    id INT PRIMARY KEY,
    name VARCHAR(100)
) ENGINE = InnoDB;

-- On the local server (started with --federated): a table pointing at it
CREATE TABLE local_customers (
    id INT PRIMARY KEY,
    name VARCHAR(100)
) ENGINE = FEDERATED
  CONNECTION = 'mysql://fed_user:password@remotehost:3306/remote_db/customers';

-- Queries against local_customers transparently hit the remote table
SELECT * FROM local_customers WHERE id = 1;