Database Systems · UGC NET: Enhanced Data Models
Distributed Databases and Client Server
Overview
A distributed database is a collection of logically interrelated databases stored at multiple sites connected by a network and managed by a Distributed Database Management System (DDBMS). This topic tests how a global relation is split and allocated, how users are shielded from distribution through transparency, how distributed queries use semijoins, how distributed transactions commit with 2PC, and how client-server architectures place business logic and database functions.
Before studying it, you should know the relational model, relational algebra operations such as selection, projection, union and natural join, ACID properties, basic conflict serializability, and elementary concurrency control.
The notes follow the standard Elmasri–Navathe convention for fragmentation and the common UGC convention for transparency levels.
Key concepts
- DDBMS: software that manages a distributed database so that users see one logical database even though data is stored at multiple sites.
- Global conceptual schema: describes global relations, their attributes, keys and global constraints.
- Fragmentation schema: defines how each global relation is divided into fragments.
- Allocation schema: maps each fragment to one or more sites.
- Local conceptual schema / local internal schema: describes data as actually stored at a site.
- Fragmentation divides a relation into smaller relations. It is a logical design step; allocation/replication decides where fragments are stored.
- Horizontal fragmentation: rows are partitioned using selection predicates. Example form: . Reconstruction is by union.
- Vertical fragmentation: columns are partitioned using projection. Every vertical fragment must contain the primary key. Reconstruction is by natural join.
- Derived horizontal fragmentation: a relation is fragmented according to joins with another relation; fragments of contain tuples matching fragments of . Reconstruction is still union.
- Correct fragmentation conditions:
- Completeness: every data item of the global relation appears in at least one fragment.
- Reconstruction: the original relation can be rebuilt from fragments using union and/or natural join.
- Disjointness: no tuple or non-key attribute unnecessarily belongs to more than one fragment. For vertical fragmentation, the key is repeated by design, so disjointness applies to non-key attributes.
- Transparency means hiding distribution details from users. Convention used here:
- Fragmentation transparency: user writes queries on the global relation; neither fragments nor sites are named.
- Location transparency: user may need to name fragments, but physical sites are hidden.
- Local mapping transparency: user may need to name both fragments and sites.
- Replication transparency: user is unaware of multiple copies; the DDBMS chooses a replica.
- Replication: storing copies of fragments at multiple sites.
Fully replicated means every site has a copy; partially replicated means some fragments are copied; synchronous replication commits only after participating replicas agree; asynchronous replication gives eventual consistency and does not guarantee all replicas are current at commit. - Semijoin returns only those tuples of that match some tuple of on the join attributes, projected on the attributes of . It is used to reduce communication before shipping data to the join site.
- Distributed transaction: a transaction that updates data at more than one site. It must be atomic: commit at all participating sites or abort at all.
- Two-Phase Commit (2PC): atomic commit protocol with Phase 1 voting/prepare and Phase 2 decision/commit or abort.
- Three-Phase Commit (3PC): adds a pre-commit phase; it reduces blocking under certain failure assumptions but does not eliminate all blocking under network partitions.
- Recovery management techniques in DDBMS include 2PC, backup, and immediate update with before-image/after-image logging.
- Conflict serializability: a schedule is conflict serializable iff its precedence graph is acyclic.
A conflict occurs only when two operations belong to different transactions, access the same data item, and at least one is a write. Read-read never conflicts. - Client-server database architecture: in two-tier, clients handle presentation and may contain some logic, while the database server enforces integrity constraints, concurrency control and recovery.
In three-tier, the middle tier is an application server or business-logic layer.
How it works
-
Design fragmentation and check correctness. For horizontal fragmentation, define selection predicates so that every tuple satisfies at least one predicate, predicates disjointly cover rows, and union reconstructs the relation. For vertical fragmentation, project attribute sets, include the primary key in every fragment, ensure every non-key attribute appears, and reconstruct by natural join. For mixed fragmentation, reconstruct by the inverse sequence of joins and unions.
-
Localize and reduce a distributed query. Replace a global relation by its fragments. Then use predicate implication and contradiction to remove irrelevant fragments. If a query predicate implies a fragment predicate, keep the fragment. If it contradicts a fragment predicate, eliminate that fragment.
-
Use a semijoin for distributed join processing. To compute at the site of :
- Project the join attributes from : .
- Send this projection to the site of .
- Compute there.
- Send only to the site of .
- Join with locally. This is useful when only a small part of matches .
-
Run 2PC. Phase 1: coordinator writes a begin-commit record, sends prepare to all participants; each participant its decision and votes yes if it can commit, otherwise no. Phase 2: if all vote yes, coordinator commit and sends commit; if any votes no, it sends abort. Participants acknowledge. Once a participant votes yes, it cannot unilaterally abort before the global decision.
-
Check conflict serializability. Make one node for each transaction. Add an edge if an operation of precedes a conflicting operation of . If the graph has a cycle, the schedule is not conflict serializable. Local serializability at every site is not enough for global serializability; 2PC guarantees atomic commit, not conflict serializability.
-
Process a client-server request. The client sends SQL or an API call. The database server parses, optimizes and executes it, enforces integrity constraints, performs concurrency control and logging, and returns the result. In a three-tier system, the middle-tier application server first applies business rules and then calls the database server.
Drawing the diagram…
Drawing the diagram…
Formulas
-
Let be the number of tuples in relation , and let be the tuple size in bytes.
-
Data volume: .
-
Semijoin cost for computing at the site of , where is the join-attribute projection sent to and is the reduced relation sent back:
-
Full-transfer cost for shipping all of to the site of : .
-
2PC message count: let be the number of participants receiving prepare/decision messages. With no failures and counting prepare, vote, decision and acknowledgement messages, total . Without final acknowledgements, total .
Worked examples
Example 1: Horizontal fragmentation correctness.
Relation EMP(eid, name, dept) contains Ramesh, Geeta, Pinki, Ankur and Sunita in departments CSE, ECE, CSE, ECE and MECH respectively. Define and . Completeness fails because Sunita’s MECH tuple is in no fragment.
Disjointness holds because one tuple has one department value. If we add , then reconstructs EMP exactly.
Example 2: Vertical fragmentation.
Let have key . Take and . Every fragment contains the key ; every non-key attribute appears exactly once; and returns because the join is on the key. This is valid.
If instead without , the natural join has no common key and cannot reconstruct . Natural join is commutative, so .
Example 3: Semijoin cost.
Site A has with 10000 tuples of 200 bytes: bytes. Site B has with 500 tuples of 40 bytes. The projection has 300 tuples of 10 bytes bytes. Suppose has 100 tuples bytes. Semijoin cost bytes.
Shipping all of to B costs bytes. The semijoin saves bytes.
Example 4: 2PC message count and blocking.
A fund transfer from Deepa’s account at one site to Imran’s account at another uses 2PC. Let there be 3 participants and a separate coordinator. No failures.
Prepare sends , votes , decision sends , acknowledgements ; total . If one participant votes no, the coordinator sends abort to all; a participant that voted yes must still abort and cannot commit alone.
This is the blocking problem of 2PC.
Example 5: Query reduction over horizontal fragments.
Let be fragmented as and . Query . Since implies , can only use . Since contradicts , is eliminated. Correct reduction: .
Comparison
| Point | Horizontal fragmentation | Vertical fragmentation |
|---|---|---|
| Split basis | Rows | Columns |
| Operation | Selection | Projection |
| Reconstruction | Union | Natural join |
| Key rule | No special key repetition | Primary key must be in every fragment |
| Disjointness | No tuple in more than one fragment | Non-key attributes appear once; key repeats |
| Transparency level | Fragments named? | Sites named? |
|---|---|---|
| Fragmentation transparency | No | No |
| Location transparency | Usually yes | No |
| Local mapping transparency | Yes | Yes |
| Replication transparency | Copies hidden | Chosen by DDBMS |
| Feature | 2PC | 3PC |
|---|---|---|
| Phases | Prepare, decision | Prepare, pre-commit, decision |
| Blocking | Can block if coordinator fails after yes votes | Reduces blocking under certain assumptions |
| Network partition | Not solved | Still not fully solved |
| Feature | Two-tier client-server | Three-tier client-server |
|---|---|---|
| Layers | Client and database server | Client, application server, database server |
| Business logic | Often in client or server | Mainly in middle tier |
| Integrity and concurrency control | Database server | Database server |
| Scalability | Limited for many clients | Better |
Revision summary
- Completeness means no global data item is left out of all fragments.
- Horizontal reconstruction is union; vertical reconstruction is natural join.
- Include the primary key in every vertical fragment.
- Semijoin sends join attributes first, then only matching rows.
- 2PC has voting and decision phases; after voting yes, a participant cannot unilaterally abort.
- 2PC guarantees atomic commit, not global conflict serializability.
- RR operations never conflict; RW, WR and WW may conflict.
- Precedence graph acyclic means conflict serializable.
- Location transparency hides sites, but the query may still name fragments.
- In client-server DBMS, the database server enforces integrity and concurrency control.
- In three-tier architecture, the middle tier holds application or business logic.
- Mixed fragmentation reconstruction is not generally commutative; vertical natural-join reconstruction is commutative.
Previous-year exam insights
- Direct definition questions ask for completeness, reconstruction, disjointness, location transparency and fragmentation transparency; read the exact wording, especially whether fragments or sites must be named.
- Match-the-list questions pair horizontal fragmentation with union, vertical fragmentation with natural join, derived fragmentation with semijoin/join-based partitioning, and replication with multiple copies.
- Statement-type questions test whether vertical fragments include the key, whether vertical join is commutative, and whether mixed reconstruction is always commutative.
- Semijoin questions ask what is sent first and what is returned: only join attributes are sent, then only required rows are returned.
- Distribution questions often ask which component enforces integrity constraints and concurrency control: the database server, not the client.
- 2PC questions test the voting phase, blocking after a yes vote, and message count; distinguish 2PC from 3PC and atomic commit from serializability.
- Numeric questions use data volume , semijoin communication cost, or messages for 2PC with acknowledgements.
- Conflict-serializability questions are solved by building a precedence graph; do not mark read-read pairs as conflicts.
Practice at PARIKSHA
You are ready for the PARIKSHA tests of this sub-topic when you can:
- Define DDBMS and list the global, fragmentation, allocation and local schema levels.
- Classify fragmentation transparency, location transparency, local mapping transparency and replication transparency by what the query must name.
- Test a horizontal fragmentation for completeness, disjointness and reconstruction using union.
- Test a vertical fragmentation for key inclusion, attribute coverage and reconstruction using natural join.
- Explain the semijoin algorithm and compute whether it reduces communication over full transfer.
- Explain both phases of 2PC, state the blocking problem, and calculate message counts for a given number of participants.
- Distinguish 2PC from 3PC and synchronous from asynchronous replication.
- Check conflict serializability using a precedence graph and explain why local serializability may not imply global serializability.
- Describe two-tier and three-tier client-server architecture and identify where integrity, concurrency control and business logic are enforced.
- Reduce a query over horizontal fragments using predicate implication and contradiction.
Attempt the PARIKSHA sub-topic test first, then the subject test.