Chapter 21 · Advanced MariaDB Features: System-Versioned Tables, Oracle Mode, and Federation

Spider/Federated Data Access Concepts, Distributed Queries, and Operational Tradeoffs

Evaluate MariaDB remote-table mechanisms through plugin availability, network and transaction boundaries, credential handling, pushdown behavior, failure modes, and distributed ownership.

Advanced190–235 minutesoptional two-node Spider/federation labMariaDB Community 12.3.2 current GA referenceCurriculum anchor: MariaDB 11.8 LTS · verify exact feature/plugin availabilityFree local tooling · Last reviewed: August 2026

Learning outcomes

ServiceHub’s reporting team wants a local table that transparently reads rows stored on another MariaDB server. Remote-table engines can make that possible, but “SELECT looks local” does not mean the data is local, the transaction is local, or the failure modes are local. This lesson treats federation as a distributed system with explicit ownership.

01

Distinguish Spider, FederatedX/FEDERATED naming, remote-server definitions, and local proxy-table metadata.

02

Verify package/plugin/engine availability before presenting any remote-table syntax as usable.

03

Explain query pushdown, network latency, remote transactions, credentials and partial-failure boundaries.

04

Build a free local two-instance learning topology or follow a zero-install inspection path when the plugin is unavailable.

05

Compare federation with ETL, CDC, replication and dedicated federated-query systems based on freshness and operational ownership.

Current product boundary

MariaDB documentation currently marks FederatedX as deprecated. Spider remains documented as an optional storage engine; package names and installation steps differ by distribution. The mandatory concept path therefore verifies availability first and does not require FederatedX. The hands-on multi-node Spider lab is explicitly topology-heavy and optional when local packaging is unavailable.

1. A remote table is a network client disguised as a table

Mechanism Local object Remote behavior Current caution
Spider ENGINE=SPIDER table Connects to one/more data nodes; can shard/federate Plugin/package + topology required
FederatedX ENGINE=FEDERATED table Constructs SQL against remote server Deprecated
Replication Local replica table Copies data asynchronously Freshness/lag, but reads local
ETL/CDC Materialized target Pipeline moves/transforms changes Operational pipeline ownership

Federation minimizes copy latency because the query reaches the source at execution time. The price is coupling: source availability, network latency, credentials, remote locks and remote schema changes enter the local query path.

2. Verify the engine before writing DDL

sql · capability inventory
SELECT VERSION() AS server_version;SHOW ENGINES;SELECT ENGINE,SUPPORT,COMMENTFROM information_schema.ENGINESWHERE ENGINE IN ('SPIDER','FEDERATED');SELECT PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE,PLUGIN_LIBRARYFROM information_schema.PLUGINSWHERE PLUGIN_NAME LIKE '%SPIDER%' OR PLUGIN_NAME LIKE '%FEDERAT%';

No result is evidence: the feature is not currently available in this server package. Do not jump directly to INSTALL SONAME on production; first verify the OS package, plugin file, exact server version, backups, privileges and rollback behavior.

3. Optional free local Spider topology

terminal · package examples; verify your distribution first
# Debian/Ubuntu example from current MariaDB documentation:sudo apt install mariadb-plugin-spider# RHEL-family MariaDB repository example may use MariaDB-spider-engine.# Other distributions may bundle the engine differently.# Then, on the disposable Spider node only:# INSTALL SONAME 'ha_spider';

This lab needs two local MariaDB instances: a Spider node that receives the query and a data node that owns the real table. Containers, VMs, or two local ports are all acceptable free-learning paths. Never use real production credentials.

sql · data node fixture
CREATE DATABASE remote21;CREATE USER 'spider_lab'@'%' IDENTIFIED BY 'replace-with-disposable-secret';GRANT SELECT,INSERT,UPDATE,DELETE ON remote21.* TO 'spider_lab'@'%';CREATE TABLE remote21.ticket_fact (  ticket_id BIGINT PRIMARY KEY,  status VARCHAR(20) NOT NULL,  updated_at DATETIME(6) NOT NULL) ENGINE=InnoDB;INSERT INTO remote21.ticket_fact VALUES (1,'open',NOW(6)),(2,'closed',NOW(6));
sql · Spider node mapping
INSTALL SONAME 'ha_spider';SELECT ENGINE,SUPPORT FROM information_schema.ENGINES WHERE ENGINE='SPIDER';CREATE SERVER dataNode1 FOREIGN DATA WRAPPER mysqlOPTIONS ( HOST 'data-node-hostname', DATABASE 'remote21', USER 'spider_lab', PASSWORD 'replace-with-disposable-secret', PORT 3306);CREATE DATABASE advanced21_l4;CREATE TABLE advanced21_l4.ticket_fact (  ticket_id BIGINT PRIMARY KEY,  status VARCHAR(20) NOT NULL,  updated_at DATETIME(6) NOT NULL) ENGINE=SPIDERREMOTE_SERVER=dataNode1 REMOTE_DATABASE=remote21 REMOTE_TABLE=ticket_fact;SELECT * FROM advanced21_l4.ticket_fact ORDER BY ticket_id;

4. Observe remote ownership instead of trusting the abstraction

Run the same query while measuring local statement time and data-node activity. Then stop only the disposable data node. The local table definition still exists, but reads should fail or wait according to engine/network settings. That failure is the proof that availability is remote.

sql · local evidence
SHOW CREATE TABLE advanced21_l4.ticket_fact\GEXPLAIN SELECT * FROM advanced21_l4.ticket_fact WHERE ticket_id=1;SHOW FULL PROCESSLIST;-- On the data node, observe incoming sessions while a federated query runs:SHOW FULL PROCESSLIST;

EXPLAIN on the Spider node does not magically reveal every remote execution decision. For production analysis, inspect both sides and use exact Spider diagnostics/version docs. A predicate can be cheap locally but expensive remotely depending on pushdown and remote indexes.

5. Wrong approach: put a privileged password in table DDL

Embedding a broad administrative account in a connection string turns schema metadata/backups into credential material and increases blast radius. The safer pattern is a dedicated least-privilege remote identity, restricted network reachability, TLS where supported/configured, secret-management controls, and explicit credential-rotation procedures. Even CREATE SERVER definitions are sensitive metadata.

6. Transaction and consistency boundaries

Distributed storage engines can support some transaction features, and Spider documents XA-related capabilities, but application correctness still depends on the exact topology, backend engines, connection options and failure phase. A network loss after one remote participant changes state can create outcomes that are fundamentally different from a single local InnoDB transaction. Do not advertise atomicity until you have failure-injection evidence for the exact design.

Requirement Federation question Alternative if answer is weak
Sub-second fresh remote read Can source/network meet latency SLO? replica or cache
Cross-source transaction What happens on partial failure? application saga/outbox or redesign
Heavy analytics Can source absorb pushdown/scans? ETL/CDC to analytical store
Operational isolation Can source outage be tolerated? materialized local copy
Simple lookup Is remote dependency acceptable? federation may fit

7. Cleanup and checks

sql · cleanup order
DROP TABLE IF EXISTS advanced21_l4.ticket_fact;DROP DATABASE IF EXISTS advanced21_l4;DROP SERVER IF EXISTS dataNode1;-- Drop disposable remote user/database on the data node.-- Uninstall the Spider plugin only if this lab installed it and no other objects depend on it.

Check your reasoning

  1. Why verify SHOW ENGINES before CREATE TABLE?
  2. Why can a local SELECT fail when the local server is healthy?
  3. Why is FederatedX not the preferred new teaching path?
  4. What does a least-privilege remote account protect?
  5. Why compare federation with CDC/ETL?
Review the answers
  1. Storage-engine support depends on package/plugin/version state; conceptual support does not mean the engine is installed or enabled.

  2. The storage engine may need the remote data node and network for every query.

  3. Current MariaDB documentation marks it deprecated; new designs should evaluate supported alternatives and Spider/other architectures explicitly.

  4. It limits the damage if federation credentials or metadata are exposed and narrows what the Spider/federated path can modify.

  5. Federation trades data-copy lag for runtime source coupling; CDC/ETL trades freshness for local query isolation and different operational ownership.

Production judgment and bridge to Lesson 5

Use federation only when the value of live remote access exceeds the operational coupling it creates. Name the owner of the remote schema, network, credentials, latency SLO and incident response before launch. Lesson 5 generalizes that decision discipline across MariaDB’s temporal, search, spatial, vector and federation features: the right question is not “Can MariaDB do it?” but “Should this workload live here?”

Distributed access means distributed failure domains

A federated table makes a remote data source look local, but network latency and partial failure do not disappear. Each remote lookup can introduce DNS/TCP/TLS/authentication cost, remote lock waits, remote optimizer decisions, and network transfer. A local query plan may therefore hide a remote bottleneck. Measure which predicates and projections are pushed down, how many remote rows cross the network, and what happens when the remote endpoint is slow rather than completely unavailable.

Transaction semantics require especially careful documentation. Do not assume that a local transaction containing local InnoDB work and remote-engine work has one atomic commit protocol. Verify the exact engine's transaction guarantees and failure behavior. If the network breaks after one side changes state, define how the application detects and reconciles partial outcomes. For workflows that require cross-system atomicity, a federated table may be the wrong integration boundary.

Credentials and ownership are operational concerns. Remote connection information must be protected, rotated, and scoped to least privilege. The team that owns the local MariaDB query also needs an escalation path for the remote service because “database query slow” can actually mean a network or remote-system incident. Observability should include remote endpoint latency/errors and not only the local statement digest.

Compare alternatives by data freshness and ownership. ETL creates a copied dataset with scheduled freshness; CDC streams changes into another store; application/API composition keeps system boundaries explicit; a dedicated federated query engine may offer richer cross-source optimization. Spider/Federated-style access can be useful for specific MariaDB-centered integration cases, but the architecture decision should state why its consistency, latency, failure, and maintenance model fits the workload.

Remote-query test matrix: latency, outage, partial results, and recovery

Test more than the happy path. Add fixed network latency, terminate the remote endpoint, revoke/rotate the remote credential, and make a remote query block on a lock. Record what the local statement returns, how long it waits, which error is surfaced, and whether the connection/engine recovers automatically for the next request. Those observations define the application timeout and retry policy more accurately than a feature list.

For production ownership, document where the authoritative data lives, who may change the remote schema, how compatibility is coordinated, and how local queries are alerted when remote latency or row shape changes. A federated mapping is an API contract disguised as a table; schema evolution and availability therefore need cross-team coordination.

Authoritative references

Keep knowledge open

Help the academy stay free and grow.

If these tutorials save you time, a small donation supports new lessons, technical review, diagrams, examples, and long-term maintenance.

ETHEthereum / ERC-20 only
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0

Send only assets compatible with the Ethereum/ERC-20 network. Do not send TRC-20/TRON assets.