Centralised and Distributed Databases
A centralised database keeps all data at one site; a distributed database spreads it across several. The choice changes availability, performance, complexity and how hard consistency becomes.
-
DBMS Fundamentals
- Data, Information and Databases
- What a DBMS Is and Why It Exists
- File System versus DBMS
- Advantages and Limitations of a DBMS
- Database Users and the Role of the DBA
- Three Level Architecture and Data Abstraction
- Logical and Physical Data Independence
- Schema, Instance and Metadata
- Database Applications and the Database System Environment
- Database Architecture
- Data Models
-
ER Model
- Entities, Entity Sets and Entity Types
- Types of Attributes in the ER Model
- Keys in the ER Model
- Relationships, Relationship Sets and Degree
- Cardinality and Participation Constraints
- Strong and Weak Entities
- Drawing and Reading ER Diagrams
- Extended ER: Generalisation, Specialisation and Aggregation
- Converting an ER Diagram into Relational Tables
- ER Design Projects
- Relational Model
- Relational Algebra
- Functional Dependencies
-
Normalisation
- Why Normalisation Exists: Anomalies and Redundancy
- First Normal Form
- Second Normal Form and Partial Dependency
- Third Normal Form and Transitive Dependency
- BCNF and BCNF Decomposition
- 4NF, 5NF, Multivalued and Join Dependencies
- Lossless Decomposition and Dependency Preservation
- Complete Worked Normalisation: Unnormalised to BCNF
- Denormalisation and When to Use It
Concept
A centralised database stores the entire database at a single site, managed by one DBMS. A distributed database stores parts of it at several sites connected by a network, managed so that users can treat it as one database.
The distinguishing question is not how many machines exist, but how many independent copies of the management responsibility exist. Two servers replicating one database are still logically one system; two sites each owning different data are distributed.
Centralised
Chennai Madurai Coimbatore
| | |
+--------------+---------------+
|
+-------v--------+
| ONE database |
| ONE DBMS |
+----------------+- Advantages — one copy of every fact, so consistency is straightforward; simple administration, backup and security; no distributed transaction problem; cheaper to run.
- Disadvantages — a single point of failure; every remote user pays the network distance; the single site is a capacity ceiling; a local outage stops everyone.
Distributed
SITE A SITE B SITE C
+-----------+ +-----------+ +-----------+
| DBMS | | DBMS | | DBMS |
| south |<======>| north |<======>| west |
| customers | | customers | | customers |
+-----------+ +-----------+ +-----------+
A user asks one question. The system decides which sites
hold the answer, gathers the parts and returns one result.
Ideally the user never learns there was more than one site.- Advantages — data sits near the users who need it; one site failing need not stop the others; capacity grows by adding sites; matches organisations that are themselves distributed.
- Disadvantages — far more complex; keeping copies consistent is hard; transactions spanning sites need a commit protocol; queries may move large amounts of data; security must be enforced everywhere.
Comparison
| Point | Centralised | Distributed |
|---|---|---|
| Location of data | One site | Several sites |
| Consistency | Naturally maintained | Requires protocols and effort |
| Availability | Site failure stops everything | Other sites can continue |
| Local performance | Poor for distant users | Good where data is placed well |
| Administration | Simple | Complex, often per site |
| Transactions | Ordinary commit | Two phase commit across sites |
| Cost | Lower | Higher in software, network and skill |
| Scalability | Limited by the one site | Grows by adding sites |
Transparency: the promise a distributed system makes
A distributed database aims to hide its distribution. The kinds of transparency are worth naming, because they reappear in Phase 15.
| Transparency | What is hidden |
|---|---|
| Location | Which site holds the data. |
| Fragmentation | That a table is split across sites. |
| Replication | That several copies exist. |
| Concurrency | That other transactions are running elsewhere. |
| Failure | That a site is currently unreachable. |
Homogeneous and heterogeneous
- Homogeneous — every site runs the same DBMS product with the same schema approach. Cooperation is easy.
- Heterogeneous — sites run different products, sometimes different data models. Requires translation, and is far harder. Often the result of a merger rather than a design decision.
Example
A bank with branches in three cities
CENTRALISED
all accounts in Chennai. A Coimbatore customer withdrawal
crosses the network for every read and write. If the
Chennai link fails, Coimbatore cannot serve anyone.
DISTRIBUTED
each branch stores its own customers locally. Local
withdrawals are fast and survive a link failure.
A transfer BETWEEN branches now spans two sites and needs
two phase commit, so the difficulty moved rather than
disappeared.Common mistakes
- Calling replication a distributed database. Replicating one database for availability is not the same as splitting ownership of data across sites.
- Assuming distributed is faster. It is faster for local access and slower for anything that spans sites.
- Ignoring the transaction cost. The moment a transaction touches two sites, a commit protocol is required and it can block.
- Forgetting heterogeneity. Most real distributed systems become heterogeneous through mergers and acquisitions.
Exam and interview questions
- Differentiate centralised and distributed databases on at least six points.
- List the five kinds of transparency a distributed database aims for.
- Distinguish homogeneous and heterogeneous distributed systems.
- Why does a distributed database need a commit protocol that a centralised one does not?
- Give one case where a centralised database is the better engineering choice.
Practice
- For a national railway reservation system, argue for one architecture in five sentences.
- Name which transparency is broken when a user must know which site to connect to.
- List three failures a distributed system survives and one it handles worse than a centralised one.
Conclusion
Centralised keeps everything in one place and buys simplicity at the cost of availability and distance. Distributed places data near its users and buys that with genuine complexity in consistency, transactions and administration.