Federation
Federation (or functional partitioning) splits databases by function: one for users, another for products, another for orders. Several distinct physical databases appear as 1 single logical database to users. It also gives a unified view of data from many sources, even unstructured ones. It's like a mall: there are many different stores, but to you it's 1 place with 1 entrance.
A federated database is transparent: it hides the differences and implementations of the underlying data sources, so the user doesn't need to know where each piece of data is stored. It's like ordering a ride through an app: you don't know which company owns the car or where its base is, you just order and it comes. With 4 databases behind it, the user writes 1 query and the federation knows which to go to.
Besides being transparent, a federated database has other traits. Heterogeneity: it handles sources with different hardware, network protocols and data models. Extensibility: adding new sources is easy when the business changes. Autonomy: it doesn't change existing sources. Integration: it combines data from different protocols and DBMSs. It's like an interpreter at a meeting of 5 countries: each speaks their language and the interpreter connects them without changing anyone.
Federation has advantages: it shares data flexibly, each database keeps its autonomy, different data is accessed in a unified way, and apps aren't tied to old (legacy) databases. Also, each database gets only its function's traffic, so it works less. It's like a medical building: each doctor runs their own practice, but there's 1 reception desk for all.
Federation also has downsides: it adds hardware and complexity, joining data from 2 different databases is complicated, it depends on autonomous sources you don't control, and query performance and scalability can suffer. It's like planning a trip with 3 agencies: you get everything, but coordinating schedules across all 3 is slow and if one fails it affects you.
Federation and sharding split data in different ways. Federation splits by function: users in one database, products in another. Sharding splits by rows: users 1 to 1,000 on one shard and 1,001 to 2,000 on another, with the same table. They can be combined: federate by function and, if the users database grows a lot, shard it. It's like a supermarket: sections by type (federation) and, if a section is huge, several identical aisles (sharding).
