0% found this document useful (0 votes)
3 views38 pages

Distributed_database

Distributed Data Processing (DDP) involves distributing data and applications across multiple interconnected computers to enhance efficiency and flexibility. It can be centralized or decentralized, each with its own advantages and disadvantages. Distributed Database Management Systems (DDBMS) provide a unified view of data stored across various locations, offering improved reliability, performance, and scalability, but also facing challenges like complexity and data consistency.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views38 pages

Distributed_database

Distributed Data Processing (DDP) involves distributing data and applications across multiple interconnected computers to enhance efficiency and flexibility. It can be centralized or decentralized, each with its own advantages and disadvantages. Distributed Database Management Systems (DDBMS) provide a unified view of data stored across various locations, offering improved reliability, performance, and scalability, but also facing challenges like complexity and data consistency.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 1 Introduction

What is Distributed data Processing? (DDP)


Ans: Distributed Data Processing (DDP) is a system in which data and application programs are distributed
across multiple interconnected computers (sites) to meet an organization’s information processing needs.
Instead of relying on a single central system, processing tasks are shared among different nodes, improving
efficiency and flexibility.
DDP can be implemented in two forms:
1. Centralized Data Processing:
A single machine controls all data access and processing. It is suitable when data is shared across applications,
many users require consistent data, and security is centrally managed. It ensures better control but may create

bottlenecks.
2. Decentralized Data Processing:
Multiple machines manage data independently at different locations. It is useful when data is used locally,
faster access is needed, and responsibilities are distributed. This approach improves performance but
increases complexity.
Advantages of DDP:
• Faster processing through parallel execution
• Improved reliability and availability
• Efficient resource utilization
Disadvantages:
• Complex system design
• Data consistency and security challenges
Conclusion:
DDP provides a flexible and scalable approach for handling large and geographically distributed data systems.

2. write down the advantages and disadvantages of distributed database


management systems.
Ans: Advantages and Disadvantages of Distributed Database Management Systems (DDBMS)
A Distributed Database Management System (DDBMS) manages data stored across multiple locations while
providing a unified view to users. It offers several benefits but also introduces certain challenges.

Advantages of DDBMS
1. Improved Reliability and Availability:
Data is stored at multiple sites, so failure at one location does not affect the entire system. Other nodes can
continue functioning, ensuring high availability.
2. Better Performance:
Queries can be executed locally at different sites, reducing response time and network congestion. Parallel
processing further enhances performance.
3. Scalability:
New nodes or sites can be easily added without major changes to the system, making it suitable for growing
organizations.
4. Data Localization:
Data can be stored closer to where it is frequently used, improving access speed and efficiency.
5. Reduced Communication Cost:
Local processing minimizes the need for transferring large amounts of data across the network.

Disadvantages of DDBMS
1. Complex Design and Management:
Designing and maintaining a distributed system is more complicated than a centralized database due to
multiple nodes and coordination requirements.
2. Data Security Issues:
Since data is spread across various locations, ensuring consistent security policies becomes difficult.
3. Data Consistency Challenges:
Maintaining consistency among replicated data at different sites is a major challenge, especially during
updates.
4. Higher Cost:
Initial setup cost is high due to networking, hardware, and software requirements.
5. Network Dependency:
The system heavily depends on network reliability. Network failures can disrupt communication between
nodes.

what is the difference between parallel database and distributed database?


Ans : A Parallel Database and a Distributed Database both use multiple machines, but their purpose and
design differ significantly.
Parallel Database:
A parallel database is designed to improve performance by executing multiple operations simultaneously on
tightly coupled systems. It usually operates under a single DBMS with shared memory or shared disk
architecture. The main goal is speed and high performance for large-scale data processing tasks such as
complex queries and analytics.
Distributed Database:
A distributed database stores data across multiple geographically separated sites connected via a network.
Each site may operate independently but appears as a single system to users. The focus is on data distribution,
availability, and reliability rather than just performance.
Key Differences:
• Goal: Parallel DB focuses on performance; Distributed DB focuses on availability and data sharing.
• Location: Parallel DB is usually in one location; Distributed DB spans multiple locations.
• Control: Parallel DB uses a single centralized control; Distributed DB may have decentralized control.
• Coupling: Parallel systems are tightly coupled; distributed systems are loosely coupled.
• Failure Handling: Distributed DB is more fault-tolerant than parallel DB.
Conclusion:
Parallel databases optimize speed, while distributed databases emphasize data distribution and reliability .

what are the fragmentation , replication and local transperancy?


Ans: 1. Fragmentation Transparency
Fragmentation transparency means users are unaware that a database is divided into smaller parts (fragments)
such as horizontal, vertical, or mixed. The system allows users to access data as if it is stored in a single, unified
table, without needing to know how it is split or where each fragment is located.

2. Replication Transparency
Replication transparency ensures that users do not know whether data is duplicated (replicated) across
multiple sites. The system automatically manages multiple copies of data and ensures consistency among
them. Users interact with the database as if only a single copy exists.

3. Local Mapping Transparency


Local mapping transparency hides the differences between local schemas at different sites and presents a
unified global schema to users. Even if different sites store data in different formats or structures, users can
access it in a consistent way without worrying about local database details.
These transparencies simplify user interaction by hiding the complexity of distributed databases.

6. "High reliability does not ensure correctness of the distributed system"


comment critically
Ans: High reliability means a distributed system continues to operate despite failures, ensuring availability
and fault tolerance. However, reliability alone does not guarantee correctness. A system may be highly reliable
yet produce incorrect or inconsistent results due to issues like data inconsistency, concurrency conflicts, or
synchronization errors.

In distributed systems, problems such as network delays, partial failures, and lack of proper coordination (e.g.,
during transactions) can lead to violations of correctness properties like atomicity and consistency. For
example, replicated data may be available but not properly updated across all sites.
Thus, correctness depends on proper algorithms, concurrency control, and consistency mechanisms, not just
reliability. A reliable system must also ensure accurate and consistent results to be truly effective.

7. what are the components which are necessary for building a distributed
database?
Ans: Components Necessary for Building a Distributed Database (DDBMS)
A Distributed Database Management System requires several key components to function efficiently across
multiple sites:
1. Distributed Database (Data Storage):
The actual data stored across different locations. It may be fragmented or replicated depending on system
design.
2. Database Management System (DBMS) Software:
Software at each site that manages local data operations and interacts with other sites to provide a unified
view.
3. Communication Network:
A network that connects all sites and enables data transfer and coordination between them.
4. Distributed Transaction Management:
Ensures that transactions are executed correctly across multiple sites, maintaining properties like atomicity and
consistency (e.g., using Two-Phase Commit).
5. Concurrency Control Mechanism:
Manages simultaneous access to data to prevent conflicts and maintain consistency across the system.
Conclusion:
These components work together to ensure efficient, reliable, and consistent operation of a distributed
database system.

8. Describe the reference architecture of a distributed database management


system with proper diagram.
Ans: The reference architecture of a DDBMS provides a structured framework showing how data is organized
and managed across multiple sites while presenting a unified view to users.

Main Components / Levels:


1. Global External Schema:
Defines user views at different sites. It represents how users interact with the distributed database without
knowing its internal details.
2. Global Conceptual Schema:
Provides a unified logical view of the entire database. It integrates all data from different sites into a single
global structure.
3. Fragmentation Schema:
Describes how the global database is divided into fragments (horizontal, vertical, or hybrid) for distribution.
4. Allocation Schema:
Specifies where each data fragment is stored across different sites.
5. Local Mapping Schema:
Maps global fragments to local database schemas at each site.
6. Local Conceptual Schema:
Represents the logical structure of the
database at each individual site.
7. Local Internal Schema:
Defines the physical storage details of
data at each site.

Design Approaches:
• Top-Down Approach: Starts from
global schema and then fragments and
allocates data.
• Bottom-Up Approach: Integrates
existing local databases into a global
schema.

9. What is Distributed Database Systems? Explain the features of DDBS.


Ans: A Distributed Database System (DDBS) is a collection of multiple logically related databases distributed
across different locations (sites) and connected through a network. It is managed by a Distributed Database
Management System (DDBMS), which provides users with a single unified view of the data, even though it is
physically stored at multiple sites.

Features of DDBS
1. Data Distribution:
Data is stored at multiple geographically separated sites. It may be fragmented or replicated depending on
system requirements.
2. Transparency:
The system hides the complexity of distribution from users. This includes location, fragmentation, and
replication transparency.
3. Data Independence:
Changes in data structure or storage location do not affect application programs, ensuring flexibility.
4. Reliability and Availability:
Failure of one site does not stop the entire system. Other sites continue functioning, ensuring continuous
access.
5. Improved Performance:
Local data access and parallel processing reduce response time and enhance system efficiency.
6. Scalability:
New sites or nodes can be added easily without major system redesign.
7. Distributed Transaction Management:
Ensures correct execution of transactions across multiple sites while maintaining consistency.
8. Concurrency Control:
Manages simultaneous access to data to avoid conflicts and maintain data integrity.

Conclusion:
DDBS provides efficient, reliable, and scalable data management by distributing data across multiple sites
while maintaining a unified system view.

[Link] is transparency? discuss the network transparency and replication


transparency with examples
Ans:
Transparency refers to the ability of a DDBMS to hide the complexities of data distribution, network, and
internal operations from users. It allows users to access data as if it were stored in a single, centralized
database, without needing to know where or how the data is stored.

1. Network Transparency
Network transparency hides the details of communication between different sites in a distributed system.
Users and applications do not need to know how data is transferred over the network or which protocols are
used.
• It ensures seamless interaction between nodes.
• The system automatically handles message passing and data transfer.
Example:
A user executes a query to fetch employee data. The data may come from multiple sites over a network, but
the user does not see or manage the communication process—the DDBMS handles it internally.

2. Replication Transparency
Replication transparency hides the existence of multiple copies of data stored at different sites. Users interact
with the database as if only a single copy exists.
• The system manages consistency among replicas.
• It decides which copy to access or update.
Example:
In a banking system, account data may be replicated across several branches. When a user checks their
balance, they see consistent data without knowing that multiple copies exist.

Conclusion:
Transparency simplifies distributed database usage by hiding complexity, making the system easier to use and
manage while ensuring efficiency and consistency.

11. a) Draw the ANSI/SPARC reference Architecture of Distributed database style


and discuss about the site independent Schemas.

Ans : The ANSI/SPARC architecture for distributed databases extends the traditional three-level architecture
by introducing distribution-specific layers. At the top, users interact through multiple external views. These are
integrated into a global conceptual schema, which represents the entire database logically as a single system.
Below this, the fragmentation schema defines how global relations are divided into smaller fragments. The
allocation schema specifies where these fragments are physically stored across different sites. After this, each
site has its own local mapping schema, which connects global fragments to local databases.
Site Independent Schemas
Site independent schemas are the upper-level schemas that do not
depend on any specific physical location of data. These include:
• Global Conceptual Schema:
It provides a unified logical view of the entire distributed
database. It defines all entities, relationships, and
constraints without considering where the data is stored.
• Fragmentation Schema:
It describes how the global database is partitioned into
fragments (horizontal, vertical, or hybrid). This division is
purely logical and independent of site location.
• Allocation Schema:
Although it maps fragments to sites, it is still considered
part of the global design because it defines distribution at a system-wide level rather than local
implementation.

b)show with the help of a


diagram that replicated a
copy of R2 of fragment R1 is
allocated into the different
sites as R12 and R21
.

c)when bottom up approach of distributed database design is preferable over top


down approach?
ANS: The bottom-up approach is preferred when a distributed database system is built by integrating
already existing databases rather than designing a completely new system. In many real-world situations,
organizations already have multiple independent databases at different sites. Instead of redesigning everything
from scratch (as in top-down), it is more practical to combine these local databases into a unified global
system.
This approach is especially suitable in heterogeneous environments, where different sites may use different
DBMSs, data models, or schemas. Bottom-up design allows each local database to remain largely unchanged
while creating a global conceptual schema through integration.
It is also preferred when cost, time, and effort constraints make redevelopment impractical. Additionally, it
supports gradual system evolution and easier adoption.

d)Explain the advantages of remote access via an auxiliary Program in case of


heterogeneous distributed database system with the help of diagram.

ANS: In a heterogeneous distributed


database system, different sites use
different DBMSs and data models.
Direct communication between them
is difficult due to incompatibility. To
solve this, an auxiliary program is
used as an intermediate layer
between the application program and
the remote DBMS.
The application sends a request to its
local DBMS, which forwards it to the
auxiliary program. This auxiliary
program translates the query into the
format understood by the remote
DBMS and sends it for execution.
After processing, the result is again
converted into a compatible format
and returned to the user.

Advantages
The main advantage is data model translation, allowing different DBMSs to communicate despite structural
differences. It provides interoperability, enabling integration of diverse databases without modifying existing
systems. It also ensures flexibility, as new systems can be added easily.
12. Write Short note on transperancy
ANS: Transparency in Distributed Database Management Systems (DDBMS) refers to the ability of the
system to hide the complexities of data distribution from users. It allows users to interact with the database
as if it were a single centralized system, even though the data is stored across multiple locations.
The main objective of transparency is to provide ease of use, data independence, and system simplicity. Users
do not need to know where the data is stored, how it is fragmented, or whether multiple copies exist.
There are several types of transparency in DDBMS. Location transparency hides the physical location of data.
Fragmentation transparency ensures users are unaware of how data is divided into fragments. Replication
transparency hides the existence of multiple copies of data. Naming transparency allows users to access data
using a single global name without conflicts.
Thus, transparency improves usability and efficiency by masking the internal complexity of distributed systems
while ensuring seamless data access.

13. Write Short note on Heterogeneous Database.


ANS: A Heterogeneous Database is a distributed database system in which different sites use different
DBMSs, data models, or schemas. These databases are not uniform and may vary in structure, query
language, and underlying technology, yet they are integrated to provide a unified access to users.
In such systems, data may come from relational databases, object-oriented databases, or other formats. To
enable communication between these diverse systems, special mechanisms like middleware or translators
(auxiliary programs) are used to convert queries and results between different formats.
Heterogeneous databases are commonly used when organizations merge systems or integrate legacy
databases. They provide flexibility and allow reuse of existing systems, but they also introduce challenges such
as data inconsistency, complexity, and schema integration issues.
Thus, a heterogeneous database enables integration of diverse data sources while maintaining a global view
for users.
Chapter 2: Distributed Database Design
[Link] Horizontal, Vertical, Mixed and Derived Fragmentation with examples.
Ans:
1. Horizontal Fragmentation
Horizontal fragmentation divides a relation into subsets of rows (tuples) based on certain conditions. Each
fragment contains records that satisfy a specific criterion, making it useful when data is distributed
geographically.
Example:
Consider SUPPLIER (SNUM, NAME, CITY)
• SUPPLIER₁ = suppliers where CITY = “Mysore”
• SUPPLIER₂ = suppliers where CITY = “Shimoga”
Each site stores only relevant rows, improving performance and locality.

2. Vertical Fragmentation
Vertical fragmentation divides a relation into subsets of columns (attributes). Each fragment must include a
common key (like primary key) to allow reconstruction using joins.
Example:
EMP (EMPNUM, NAME, SAL, TAX, MGRNUM, DEPTNUM)
• EMP₁ = (EMPNUM, NAME, MGRNUM, DEPTNUM)
• EMP₂ = (EMPNUM, SAL, TAX)
Here, EMPNUM acts as the key to recombine fragments.

3. Mixed (Hybrid) Fragmentation


Mixed fragmentation is a combination of horizontal and vertical fragmentation. Data is first divided by rows
and then by columns (or vice versa).
Example:
First divide EMP by department (horizontal), then split attributes like salary and personal info (vertical).

4. Derived Fragmentation
Derived fragmentation is based on relationships between tables. A fragment of one relation is derived from
another related relation, usually using foreign keys.
Example:
If EMP is fragmented by department, then PROJECT can be fragmented based on EMP’s department to
maintain related data together.
Conclusion:
Fragmentation improves performance, locality, and parallelism while ensuring the database can still be
reconstructed when needed.

What is data replication. Explain with Example


Ans: Data replication in a distributed database refers to the process of storing multiple copies of the same
data at different sites. These copies (replicas) are maintained to improve availability, reliability, and
performance of the system.
When data is replicated, users can access it from the nearest site, reducing response time. Even if one site fails,
the data is still available at other sites. However, the system must ensure that all copies remain consistent
when updates occur.

Example
Consider a BANK database where customer account information is stored.
• A copy of the ACCOUNT table is stored at Branch A (Site 1) and Branch B (Site 2).
• If a customer checks their balance at Branch A, the system retrieves data locally.
• If Branch A fails, the same data can be accessed from Branch B.
When a transaction (like deposit or withdrawal) happens, the update must be reflected in both copies to
maintain consistency.

Conclusion
Data replication improves system performance and fault tolerance, but requires proper mechanisms to
maintain data consistency across all replicas.

3. What are the advantages and disadvantages of replication?


Ans :
Advantages
Data replication improves availability because multiple copies of data exist at different sites. If one site fails,
users can still access data from another site, ensuring system continuity. It also enhances reliability, as the
system becomes fault-tolerant.
Replication provides better performance since users can access data from the nearest location, reducing
network delay and response time. It also supports load balancing, as queries can be distributed across
multiple replicas, reducing the burden on a single site.
Another important benefit is faster data access for geographically distributed users, making the system more
efficient in real-time applications.
Disadvantages
The main drawback of replication is the difficulty in maintaining data consistency. When updates occur, all
copies must be synchronized, which can be complex and time-consuming.
It also increases storage cost, as multiple copies of the same data are stored at different sites. Additionally,
there is higher communication overhead, since updates must be transmitted across the network to all
replicas.
Replication can also lead to complex system design and management, requiring sophisticated algorithms to
ensure consistency and coordination among sites.

4. What are the Correctness rules of Fragmentation? Explain Each rule


Ans: Correctness Rules of Fragmentation
Fragmentation in distributed databases must satisfy certain rules to ensure that the original relation can be
properly managed and reconstructed. These are known as correctness rules of fragmentation.
1. Completeness
Completeness means that all data of the original relation must be present in the fragments. No data should
be lost during fragmentation. Every data item in the original relation should appear in at least one fragment.
In simple terms: Nothing should be missing after fragmentation.
2. Reconstruction
Reconstruction ensures that the original relation can be rebuilt from the fragments. There must exist some
relational operation to combine fragments back into the original table.
• Union ( ∪ ) is used for horizontal fragmentation
• Join ( ⨝ ) is used for vertical fragmentation
In simple terms: You should be able to get back the original table.
3. Disjointness
Disjointness means that fragments should not overlap, i.e., the same data item should not appear in more
than one fragment.
• In horizontal fragmentation, no tuple should appear in multiple fragments
• In vertical fragmentation, attributes should not repeat (except the primary key, which is needed for
reconstruction)
In simple terms: No duplication of data across fragments.
Conclusion
These rules ensure that fragmentation is lossless, consistent, and non-redundant, making distributed
databases efficient and reliable.
5. What are the Difference among Data Fragmentation, Data Allocation, and Data
Replication
Ans: In a distributed database system, fragmentation, allocation, and replication are three important concepts
that define how data is divided, placed, and duplicated across sites.
Data Fragmentation
Data fragmentation is the process of dividing a database into smaller parts (fragments). These fragments can
be horizontal (rows), vertical (columns), or mixed. The main goal is to improve performance and locality by
breaking a large table into manageable pieces.
Data Allocation
Data allocation determines where the fragmented data should be stored in the network. It decides the
placement of fragments across different sites.
There are different strategies:
• Centralized: Entire database at one site
• Partitioned: Fragments stored at different sites
• Replicated allocation: Fragments stored at multiple sites
Data Replication
Data replication refers to storing multiple copies of data at different sites. It improves availability, reliability,
and access speed. However, it requires mechanisms to maintain consistency among copies.
Key Difference (in simple terms):
• Fragmentation → How data is divided
• Allocation → Where data is stored
• Replication → How many copies of data exist
Conclusion
These three concepts work together to ensure efficient, reliable, and scalable distributed database systems

6.a)What are the Factors Affecting Data Allocation?


b) What is Minterm Predicate?
Ans : (a) Factors Affecting Data Allocation (Summary Explanation)
Data allocation in a distributed database determines where data fragments should be stored. Several factors
influence this decision to ensure efficiency and reliability.
Response time constraints focus on minimizing query execution time. Data is placed closer to users or
applications that frequently access it, reducing delays.
Availability constraints ensure that data remains accessible even if some sites fail. This may involve placing
data at multiple sites to improve fault tolerance.
Network topology refers to the structure and connectivity of the network. Allocation decisions depend on
communication costs, bandwidth, and distance between sites to optimize data transfer.
Security restrictions ensure that sensitive data is stored only at secure or authorized locations, maintaining
confidentiality and compliance with policies.

(b) Minterm Predicate (Summary Explanation)


A minterm predicate is a combination (conjunction) of simple predicates used in fragmentation, especially
horizontal fragmentation. It includes all predicates in either their original or negated form, ensuring that the
resulting condition is logically consistent (not contradictory).
In simple terms, it represents a specific condition that defines a fragment of data.
Example:
• PNAME = “Maintenance” AND BUDGET ≤ 200000
• NOT(PNAME = “Maintenance”) AND BUDGET ≤ 200000
These predicates help divide data into meaningful fragments based on conditions.

7. a) What is Vertical Clustering?


b) What is Partial Union?
Ans : (a) Vertical Clustering (Summary Explanation)
Vertical clustering is a technique in distributed databases where an attribute may appear in more than one
fragment. This means some data elements are intentionally replicated across multiple fragments. The main
purpose is to improve performance, especially for read-only or read-heavy applications, where frequently
accessed attributes are kept together for faster retrieval.
However, this approach introduces redundancy, so in read-write applications, it can create issues because
updates must be performed at multiple sites to keep data consistent. Thus, vertical clustering is beneficial for
faster access but requires careful handling of updates.
(b) Partial Union (Summary Explanation)
Partial union refers to the union operation applied to union-compatible relations. Two relations are union-
compatible if they have the same structure (same number and type of attributes).
If R and S are union-compatible, then their union R ∪ S contains all tuples that belong to either relation. It is
called a partial operation because it is only defined for compatible relations, not for all relations.
Example:
R ∪ S = { x : x ∈ R or x ∈ S }
Thus, partial union combines data from similar structured relations into a single result.
8. What is Mixed and Horizontal Fragmentation? Explain with example.
Ans: Horizontal fragmentation is the process of dividing a relation into subsets of rows (tuples) based on
certain conditions. Each fragment contains records that satisfy a specific predicate, and all fragments together
form the complete relation.
This type of fragmentation is useful when data is distributed based on geographical or logical conditions.
Example:
Consider a relation:
SUPPLIER (SNUM, NAME, CITY)
• SUPPLIER₁ = records where CITY = “Mysore”
• SUPPLIER₂ = records where CITY = “Shimoga”
Each site stores only relevant tuples, and the original relation can be reconstructed using union (∪).
Mixed (Hybrid) Fragmentation
Mixed fragmentation is a combination of horizontal and vertical fragmentation. It is applied recursively,
meaning one type of fragmentation is applied first, followed by another, while ensuring correctness rules are
satisfied.
In this approach, fragments themselves can be further fragmented.
Example:
Consider:
EMP (EMPNUM, NAME, SAL, TAX, MGRNUM, DEPTNUM)
• First, apply vertical fragmentation to divide attributes
• Then apply horizontal fragmentation on DEPTNUM
This results in multiple fragments based on both attributes and conditions.
Reconstruction is done by applying join and union operations in reverse order.
Conclusion
Horizontal fragmentation divides data by rows, while mixed fragmentation combines both row and column
division, providing greater flexibility and efficiency in distributed databases.

9. Explain Different Types of Fragmentation Indicating Advantages and


Disadvantages.
Ans: Fragmentation in distributed databases is classified into horizontal, vertical, and hybrid (mixed)
fragmentation, each serving different design needs.
1. Horizontal Fragmentation
In horizontal fragmentation, a table is divided into subsets of rows (tuples) based on certain conditions. Each
fragment contains all columns but only selected rows.
Example:
STUDENT table → students of “Computer Science” department stored separately.
Advantage:
Improves performance as data is stored closer to where it is used.
Disadvantage:
Queries requiring data from multiple fragments may increase access time.
2. Vertical Fragmentation
In vertical fragmentation, a table is divided into groups of columns (attributes). Each fragment must include a
primary key to allow reconstruction.
Example:
STUDENT → (Regd_No, Fees) stored separately for accounts section.
Advantage:: Enhances security and privacy, as sensitive attributes can be isolated.
Disadvantage:: Requires join operations to reconstruct the original table, which may reduce performance.
3. Hybrid (Mixed) Fragmentation
Hybrid fragmentation is a combination of horizontal and vertical fragmentation. It is applied in multiple steps
to achieve better optimization.
Example:
First divide students by department (horizontal), then split attributes like fees (vertical).
Advantage: Highly flexible and provides efficient data distribution.
Disadvantage: More complex design and reconstruction process.

Overall Advantages of Fragmentation: Fragmentation improves performance, locality, and query


optimization, as data is stored near its point of use. It also enhances security by restricting access to irrelevant
data.
Overall Disadvantages: It increases system complexity, and queries involving multiple fragments may lead to
higher access time and overhead.
Conclusion: Fragmentation helps in efficient data management in distributed systems, but it must be carefully
designed to balance performance and complexity.

10. Consider the schema SUPPLIER (SNO, NAME, CITY) and SUPPLY (SNO, PNO,
DNO, QUAN) and the following transaction:
Transaction:
Read (tty, $PNO)
Select Name into $Name
From SUPPLIER, SUPPLY
Where [Link] = [Link]
AND [Link] = SPNO
Write (tty, $Name)
(a) What is the level of transparency of the above transaction and why?
ANS: The level of transparency is Fragmentation Transparency.
This is because the transaction is written using the global schema (SUPPLIER and SUPPLY) without specifying
how the data is fragmented or where it is stored. The user is unaware of fragmentation details, and the system
internally handles data distribution. Hence, it represents the highest level of transparency, where
fragmentation is completely hidden from the user.

(b) Discuss the approach for a non-replicated allocation of horizontal


fragmentation.
Ans: In non-replicated allocation, each fragment is stored at only one site without duplication. The best
approach is to use a “best-fit” strategy, where each fragment is placed at the site that provides maximum
benefit in terms of access frequency and cost.
The allocation decision is based on factors like query frequency, communication cost, and processing cost.
Since there is no replication, the system is simpler and avoids consistency issues. However, proper placement is
important to ensure efficient data access and minimal response time.

(c) Does a directory file system provide network transparency? If yes, explain how
the transparency is achieved.
Ans: Yes, a directory file system provides network transparency.
Network transparency allows users to access remote resources as if they were local. This is achieved through a
global naming mechanism, where files are identified using uniform names across all locations. Users do not
need to know the physical location of data.
It involves three key aspects:
• Naming: Same name used for a file at all sites
• Performance: Efficient access regardless of location
• Failure resilience: System handles failures without user awareness
Thus, the directory system hides network details and ensures seamless data access.

(d) What is the most complex effect of update operation in distributed database system?
Explain with the help of update subtree.
Ans: The most complex effect of update operations in a distributed database is maintaining consistency across
multiple fragments and sites. Since data may be fragmented or replicated, an update at one site may require
updates at multiple locations.
This leads to the need for coordination mechanisms like distributed transactions and commit protocols (e.g.,
Two-Phase Commit).
Update Subtree Concept:
An update operation is broken into smaller operations distributed across sites. Each node in the subtree
represents an operation at a site, and all must be successfully completed to maintain consistency.
If any part fails, the system must rollback changes to maintain correctness.

11. Discuss best-fit, all beneficial site and additional beneficial site strategy for
allocation of fragments
Ans: In distributed database design, fragment allocation strategies determine where fragments should be
placed to optimize performance, cost, and reliability.
Best-Fit Approach
In the best-fit approach, each site is evaluated based on the number of accesses required from applications at
that site.
The benefit value for placing fragment i at site j is:

𝐵𝑖𝑗 = ∑ 𝑓𝑘𝑗 × 𝑛𝑘𝑖𝑗


𝑘
Where:
• 𝑓𝑘𝑗 = frequency of application k at site j
• 𝑛𝑘𝑖𝑗 = number of accesses from application k to fragment i at site j

The fragment is allocated to the site with the maximum 𝐵𝑖𝑗


All Beneficial Site Approach
This approach considers both read benefit and update cost. A fragment is placed at all sites where net benefit
is positive.

𝐵𝑖𝑗 = ∑ 𝑓𝑘𝑗 ⋅ 𝑟𝑘𝑖𝑗 − 𝐶 ∑ ∑ 𝑓𝑘𝑙 ⋅ 𝑢𝑘𝑙𝑖


𝑘 𝑙≠𝑗
𝑘
Where:
• 𝑟𝑘𝑖𝑗 = number of read accesses
• 𝑢𝑘𝑙𝑖 = number of update accesses
• 𝐶= update cost factor

If 𝐵𝑖𝑗 > 0, the site is beneficial and selected.


Additional Beneficial Site Approach
This approach extends the previous one by also considering a reliability factor. Along with cost and benefit, it
evaluates how replication improves system reliability and availability.
Fragments are placed at additional sites if they increase both performance and fault tolerance, even if the cost
is slightly higher

12. a) Consider the two relation schemas PAY = (TITLE, SAL) and EMP = (ENO,
ENAME, TITLE) and where L = PAY and member (L) = EMP and L is the link between
the two relation schemas. Define a derived horizontal fragmentation on EMP with
the predicates SAL ≤ 20000 and SAL > 20000.
ANS: Derived horizontal fragmentation of EMP is based on fragmentation of PAY using the link attribute TITLE.
First, fragment PAY:

𝑃𝐴𝑌1 = 𝜎𝑆𝐴𝐿≤20000 (𝑃𝐴𝑌)


𝑃𝐴𝑌2 = 𝜎𝑆𝐴𝐿>20000 (𝑃𝐴𝑌)

Then derive EMP fragments:

𝐸𝑀𝑃1 = 𝐸𝑀𝑃 ⋈ 𝑃𝐴𝑌1


𝐸𝑀𝑃2 = 𝐸𝑀𝑃 ⋈ 𝑃𝐴𝑌2

Thus, EMP is divided based on salary conditions through the relationship with PAY

b) Write the BEA algorithm for vertical fragmentation.


Answer: The Bond Energy Algorithm (BEA) is used to group attributes into clusters for vertical fragmentation.

• Input: Affinity Matrix (AA)

• Output: Clustered Affinity Matrix (CA)

Steps:

1. Initialization:
Place any two attributes in CA.

2. Iteration:
Insert remaining attributes one by one into positions that maximize affinity.

𝐴𝑀 = ∑𝑎𝑓𝑓𝑖𝑛𝑖𝑡𝑦(𝐴𝑖 , 𝐴𝑗 )

3. Placement:
Choose the position that gives maximum contribution to AM.

4. Row Ordering:
Rearrange rows according to column order.

c) Discuss “all beneficial sites” and “additional replication” methods for replicated
allocation of horizontal fragments.
Answer: All Beneficial Sites Approach:
A fragment is allocated to all sites where the benefit of storing it is greater than the cost.

𝐵𝑖𝑗 = ∑𝑓𝑘𝑗 ⋅ 𝑟𝑘𝑖𝑗 − 𝐶∑𝑓𝑘𝑙 ⋅ 𝑢𝑘𝑙𝑖


If 𝐵𝑖𝑗 > 0, the site is selected.
This improves access speed but increases update cost.

Additional Replication Approach:


This method begins with a non-replicated solution and adds replicas step by step.

• Start with best site

• Add replicas to other beneficial sites

• Stop when no further benefit is achieved

13. Write short notes on the following:


(a) Vertical and Derived Fragmentation
(b) Fragmentation
Ans: Vertical fragmentation: is the process of dividing a relation into groups of attributes (columns). Each
fragment contains a subset of attributes along with a primary key so that the original relation can be
reconstructed using join operations. This type of fragmentation is useful when different attributes are accessed
by different applications, improving performance and security.
Example:
EMP (EMPNUM, NAME, SAL, TAX, MGRNUM, DEPTNUM)
can be divided as:
EMP₁ = (EMPNUM, NAME, MGRNUM, DEPTNUM)
EMP₂ = (EMPNUM, SAL, TAX)
Derived fragmentation: is a type of horizontal fragmentation where one relation is fragmented based on
another related relation using a join condition. It ensures that related data is stored together at the same site.
Example:
If PAY is fragmented based on SAL, then EMP can be fragmented based on PAY using the common attribute
(e.g., TITLE).

(b) Fragmentation
Fragmentation is the process of dividing a database or relation into smaller parts called fragments, which can
be stored at different sites in a distributed system. These fragments are logical units and must satisfy
correctness rules such as completeness, reconstruction, and disjointness.
Fragmentation improves system performance by storing data close to its point of use. It also supports parallel
processing and better query optimization. The original relation can always be reconstructed using UNION (for
horizontal) or JOIN (for vertical) operations.
Additionally, fragmentation provides fragmentation independence (transparency), meaning users are unaware
of how data is divided.
Chapter 3: Distributed Querry Optimization
[Link] are the objectives of Distributed Query Processing?
Ans: The main objective of Distributed Query Processing (DQP) is to process queries on a distributed
database in an efficient way while presenting the system as a single unified database to the user. The system
transforms a high-level query into an optimal execution strategy that can be executed across multiple sites.
A key objective is query optimization, where different execution strategies are evaluated to choose the one
that minimizes resource usage such as CPU, I/O, and communication cost. The optimizer ensures that the
chosen plan produces the same correct result while being efficient.
Another important objective is minimizing resource consumption. This includes reducing the total cost of
execution, which involves local processing at sites as well as communication between sites. Efficient use of
parallelism is also considered so that operations can be executed simultaneously at different locations,
reducing response time.
Additionally, DQP aims to reduce communication cost, since data transfer between sites is expensive. The
system tries to process data locally as much as possible and minimize data movement across the network.

[Link] do you mean by Query Processing? Write down the characteristics of query
processors.
Ans: Query Processing is a function of the Distributed Database System that is responsible for analyzing,
optimizing, and executing a user query. It converts a high-level query (like SQL) into an efficient execution plan
and performs operations across multiple sites. It also considers data distribution and generates a strategy that
minimizes cost and communication.

Characteristics of Query Processors


A query processor supports different languages, where the input is usually a high-level language (SQL) and is
translated into relational algebra or calculus. The output is an execution plan that includes both data
operations and communication steps.
It performs query optimization, where multiple execution strategies are evaluated. The best plan is selected
based on cost, using techniques like heuristic optimization or semi-joins to reduce data transfer.
The processor relies on statistics such as fragment size, cardinality, and attribute value distribution. These help
in estimating costs and choosing efficient query plans.
Decision-making may be centralized or distributed, meaning either one site or multiple sites can participate in
selecting the execution strategy.
It also considers network topology, where communication cost and local processing capabilities affect the
execution plan.
Finally, query processors exploit replicated fragments, allowing selection among multiple copies of data. This
improves performance, reduces data transfer, and enables parallel execution.
What is locking? What are shared and exclusive locks? Briefly discuss Timestamp
protocol in relation to distributed database system.
Ans: Locking is a mechanism used in database systems to ensure concurrency control. It restricts
simultaneous access to data so that only one transaction can modify a data item at a time, preventing
inconsistency. Locking can be applied at different levels such as row, page, or table level, and ensures that data
is not changed while being accessed.
Shared and Exclusive Locks
A shared lock (S-lock) is used when a transaction only wants to read data. Multiple transactions can hold
shared locks on the same data item simultaneously because reading does not affect consistency. However, no
transaction can modify the data while it is under a shared lock.
An exclusive lock (X-lock) is used when a transaction wants to update or modify data. Only one transaction
can hold an exclusive lock on a data item at a time. No other transaction can read or write that data until the
lock is released.
Timestamp Protocol
The timestamp protocol is a concurrency control technique that assigns each transaction a unique timestamp
to determine the order of execution. Transactions are executed in the order of their timestamps to maintain
consistency.
There are two approaches:
• Centralized timestamping, where a single system generates timestamps
• Distributed timestamping, where each site generates timestamps using logical clocks
In distributed systems, each site maintains a logical clock (LC). A global timestamp is formed by combining the
local timestamp with the site identifier. This ensures uniqueness and proper ordering across sites.
7. Optimize the following query: List the flats that are for rent along with the
corresponding branch details.
Relations:
Branch (Branch No., Street, Postcode)
Property (Property No., Rent Amount, Owner No., Type, Branch No.)
Fragments:
• P1: σBranch_no = “B003” (Property)
• P2: σBranch_no ≠ “B003” (Property)
• B1: σBranch_no = “B003” (Branch)
• B2: σBranch_no ≠ “B003” (Branch)
Query:
SELECT *
FROM BRANCH b, PROPERTY p
WHERE b.Branch_No = p.Branch_No
AND [Link] = 'Flat';
Ans: Relational Algebra Expression:
𝜎𝑡𝑦𝑝𝑒=′ 𝐹𝑙𝑎𝑡 ′ (𝑃𝑅𝑂𝑃𝐸𝑅𝑇𝑌) ⋈𝐵𝑟𝑎𝑛𝑐ℎ_𝑁𝑜 𝐵𝑅𝐴𝑁𝐶𝐻

Optimized Query (Using Fragmentation):


First apply selection on fragments:
𝜎𝑡𝑦𝑝𝑒=′ 𝐹𝑙𝑎𝑡 ′ (𝑃1 ∪ 𝑃2)
Now perform joins locally:
(𝑃1 ⋈ 𝐵1) ∪ (𝑃2 ⋈ 𝐵2)
Apply selection before join:
(𝜎𝑡𝑦𝑝𝑒=′ 𝐹𝑙𝑎𝑡 ′ (𝑃1) ⋈ 𝐵1) ∪ (𝜎𝑡𝑦𝑝𝑒=′ 𝐹𝑙𝑎𝑡 ′ (𝑃2) ⋈ 𝐵2)

[Link] is deadlock prevention?


Ans: Deadlock prevention is a technique used in distributed databases to ensure that deadlocks never occur.
Instead of detecting and resolving deadlocks after they happen, the system prevents them by controlling how
transactions request resources.
A transaction is allowed to proceed only if it does not lead to a deadlock situation. This is done using ordering
rules based on timestamps or priorities.
Techniques for Deadlock Prevention
A common method is assigning unique timestamps to transactions. Based on these timestamps:
• A transaction is allowed to wait only if it follows a specific order
• If the rule is violated, the transaction is aborted and restarted
Two Important Algorithms
1. Wait-Die Scheme (Non-preemptive):
• Older transaction can wait for younger
• Younger transaction requesting older → aborted
2. Wound-Wait Scheme (Preemptive):
• Older transaction requesting younger → aborts younger
• Younger transaction requesting older → waits

10. 2PL protocol only ensures that the schedule is conflict serializable or not, but it
cannot generate all possible combinations of valid serializable schedules.”
Comment critically with example.
Ans: The Two-Phase Locking (2PL) protocol ensures that every schedule generated is conflict serializable,
but it does not guarantee that all possible serializable schedules can be produced. This is because 2PL
enforces a strict rule: each transaction must first acquire all locks (growing phase) and then release them
(shrinking phase), without acquiring new locks afterward.
Due to this restriction, some valid serializable schedules cannot be generated under 2PL, even though they are
logically correct.
Key Points
• Every operation must be preceded by lock and followed by unlock
• A data item cannot be locked by multiple transactions simultaneously in conflicting modes
• Once a transaction releases a lock, it cannot acquire new locks
• Ensures conflict serializability, but restricts schedule flexibility
Example
Consider two transactions:
T1: Read(A), Write(A)
T2: Read(A), Write(A)
A possible serializable schedule could interleave operations in a way that maintains consistency. However,
under 2PL, once a transaction releases a lock, it cannot re-acquire another, which prevents some valid
interleavings from occurring.
Thus, some valid serializable schedules are not allowed under 2PL.

Critical Comment
2PL guarantees correctness (conflict serializability) but is not complete, meaning it cannot produce all
serializable schedules. It may also lead to cascading aborts and reduced concurrency.

[Link] the difference between the terms “deadlock prevention” and “deadlock
avoidance”.
Ans: Deadlock Prevention
• Prevents deadlock by restricting how resources are requested and allocated
• Ensures at least one necessary condition of deadlock is eliminated
• Static approach (rules defined in advance)
• Does not check system state dynamically
• Simple to implement
• Reduces concurrency (transactions may wait unnecessarily)
Deadlock Avoidance
• Prevents deadlock by checking each request before granting it
• Ensures system always remains in a safe state
• Dynamic approach (decision taken at runtime)
• Requires additional information about resource usage
• More complex to implement
• Allows higher concurrency (only delays when necessary)

[Link] the significance of the semi-join program in context with DDBMS.


Ans: In a Distributed Database Management System (DDBMS), a semi-join program is used to reduce data
transfer cost during join operations across different sites. Instead of transferring entire relations, only
necessary attributes are sent, making query processing more efficient.
For an equi-join:
𝑅 ⋈𝐴=𝐵 𝑆

The semi-join program is defined as: 𝑆𝐽𝑁𝐴=𝐵 = (𝑅 ⋉𝐴=𝐵 𝑆) ⋈ 𝑆

Working of Semi-Join Program


Assume relation R is at site r and S is at site s:
1. Project join attributes of S and send to site r:
𝜋𝐵 (𝑆)
Cost:
𝐶0 + 𝐶1 × 𝑠𝑖𝑧𝑒(𝐵) × 𝑣𝑎𝑙(𝐵[𝑆])
2. Compute semi-join at site r:
𝑅 ′ = 𝑅 ⋉𝐴=𝐵 𝑆

3. Send reduced relation R′ to site s:


Cost:
𝐶0 + 𝐶1 × 𝑠𝑖𝑧𝑒(𝑅) × 𝑐𝑎𝑟𝑑(𝑅 ′ )

4. Perform final join at site s:


𝑅′ ⋈ 𝑆
Total Cost of Semi-Join Program
𝐶𝑆𝐽 = 2𝐶0 + 𝐶1 (𝑠𝑖𝑧𝑒(𝐵) ⋅ 𝑣𝑎𝑙(𝐵[𝑆]) + 𝑠𝑖𝑧𝑒(𝑅) ⋅ 𝑐𝑎𝑟𝑑(𝑅 ′ ))
Cost of Direct Join (Without Semi-Join)
𝐶𝐽𝑁 = 𝐶0 + 𝐶1 × 𝑠𝑖𝑧𝑒(𝑅) × 𝑐𝑎𝑟𝑑(𝑅)
Condition for Semi-Join Efficiency
Semi-join is beneficial if:
𝐶0 + 𝐶1 (𝑠𝑖𝑧𝑒(𝐵) ⋅ 𝑣𝑎𝑙(𝐵[𝑆]) + 𝑠𝑖𝑧𝑒(𝑅) ⋅ 𝑐𝑎𝑟𝑑(𝑅 ′ )) < 𝐶1 × 𝑠𝑖𝑧𝑒(𝑅) × 𝑐𝑎𝑟𝑑(𝑅)
Significance
Semi-join significantly reduces communication cost, which is the most expensive operation in distributed
systems. It ensures that only relevant tuples are transferred instead of entire relations. This leads to improved
performance, especially when dealing with large datasets across multiple sites.
H1owever, semi-join is not symmetric, and different execution orders may result in different costs.

16. What is Serializability in a distributed database?


Ans: Serializability in a distributed database means that the execution of transactions across multiple sites
produces a result equivalent to some serial (one-after-another) execution of those transactions.
In distributed systems, each site has a local schedule, but correctness depends on the global schedule formed
by combining all local schedules. Even if local schedules are serializable, the global schedule may not be.
Hence, for correctness, a stronger condition called global serializability must be satisfied, ensuring consistency
across all sites.
[Link] is Strict 2PL? Give a brief introduction to 2PL as a distributed concurrency
control method
Ans: Two-Phase Locking (2PL) is a concurrency control protocol in which every transaction has two phases:
• Growing phase: Locks are acquired, no locks are released
• Shrinking phase: Locks are released, no new locks are acquired
This ensures conflict serializability.
In a distributed database, 2PL is applied at multiple sites. Each site maintains local locks, and transactions
follow 2PL rules globally to ensure correctness across sites.
Strict 2PL
Strict 2PL is a stricter version where:
• All exclusive (write) locks are held until commit/abort
• Locks are not released early
Advantages:
• Prevents cascading aborts
• Ensures recoverability and strict schedules
Disadvantages:
• Reduced concurrency
• Possibility of deadlocks

[Link] two objects, w be stored at site S1, and z be stored at site S2. Determine for
each of the following executions whether the execution is serializable or not. If yes,
determine all possible total orders. If no, prove that there is no total order
possible.
Ans:
Query Decomposition
This is the first stage where a high-level SQL or
calculus query is converted into an equivalent
relational algebra query on global relations. The
system checks syntax, semantics, and simplifies
the query using relational algebra rules.
2. Data Localization (Data Decomposition)
In this stage, the global query is transformed into
a query on fragments using fragmentation
information. The system determines which
fragments and sites contain the required data.
3. Global Query Optimization
The optimizer selects the most efficient execution
strategy for the distributed query. It minimizes
communication cost, response time, and
resource usage. Operations such as join ordering
and data transfer strategies are decided here.
4. Local Query Optimization
Each site receiving a subquery performs local optimization using local DBMS techniques. Local execution plans
are generated for efficient processing at individual sites.

Q4. (a) Why are distributed deadlocks occurred?


Ans: Distributed deadlocks occur in distributed database systems when multiple transactions running at
different sites wait indefinitely for resources locked by one another. This situation generally arises when
distributed transactions and concurrency control mechanisms are used simultaneously across several sites.
Because transactions execute independently at different locations, circular waiting conditions may occur,
leading to deadlocks.
(b) What are distributed wait-for graph and local wait-for graph? How wait-for
graph helps in deadlock detection?
Ans: A wait-for graph (WFG) is a directed graph used for deadlock detection.
• Each node in the graph represents a transaction/process
• A directed edge 𝑇𝑖 → 𝑇𝑗 means transaction 𝑇𝑖 is waiting for a resource held by transaction 𝑇𝑗
Local Wait-for Graph
Each site in a distributed system maintains its own local wait-for graph. It contains information only about the
transactions and resources at that particular site.
The nodes represent:
• Transactions holding resources
• Transactions waiting for resources at that site
Distributed (Global) Wait-for Graph
A global wait-for graph is formed by combining all local wait-for graphs from different sites. It is usually
maintained by a central coordinator process.
The global graph can be reconstructed:
• When edges are inserted or removed in local graphs
• Periodically after changes occur
• When the coordinator invokes the deadlock detection algorithm
How Wait-for Graph Helps in Deadlock Detection
The coordinator analyzes the global wait-for graph to detect cycles.
• Cycle present → Deadlock exists
• No cycle → No deadlock
Once a deadlock is detected, the coordinator selects a victim transaction and rolls it back to break the cycle.
However, due to communication delays or incomplete information, the global wait-for graph may sometimes
detect false deadlocks.

Q5. (a) What is query optimization?


Ans: Query Optimization (QO) is the process of selecting the most efficient execution strategy for a query among
many equivalent alternatives.
The main objective of query optimization is to:
• Reduce execution time
• Minimize CPU, I/O, and communication cost
• Improve system performance and throughput
Since complex queries may have many possible execution plans, the optimizer chooses the plan that uses minimum
resources and gives faster response.

(b) Explain Distributed Cost Model with Example


Ans: The distributed cost model estimates the cost of executing a distributed query using:
• CPU cost

• I/O cost

• Communication cost

Two important performance measures are:

1. Total Time

Total execution time is: Total Time = 𝑇𝐶𝑃𝑈 + 𝑇𝐼/𝑂 + 𝑇𝑀𝑆𝐺 + 𝑇𝑇𝑅
Where:

• 𝑇𝐶𝑃𝑈 = CPU processing time

• 𝑇𝐼/𝑂 = Input/Output time

• 𝑇𝑀𝑆𝐺 = Message initialization cost

• 𝑇𝑇𝑅 = Data transmission cost

2. Response Time : Response time is the elapsed time between query submission and completion.

Response Time = 𝑇𝐶𝑃𝑈 + 𝑇𝐼/𝑂 + 𝑇𝑀𝑆𝐺 + 𝑇𝑇𝑅


Parallel execution can reduce response time.

Example Suppose:

• Site 1 sends x units of data to Site 3

• Site 2 sends y units of data to Site 3

Then: Total Time

𝑇 = 2 × 𝑇𝑀𝑆𝐺 + 𝑇𝑇𝑅 (𝑥 + 𝑦)
Response Time

𝑅 = max⁡(𝑇𝑀𝑆𝐺 + 𝑇𝑇𝑅 (𝑥), 𝑇𝑀𝑆𝐺 + 𝑇𝑇𝑅 (𝑦))

Thus, the distributed cost model helps choose the most efficient distributed execution plan.

What do you mean by the Cardinality of Selection?


Ans: Cardinality refers to the number of tuples (rows) resulting from a selection operation or participating in
a relationship.
It specifies how many occurrences of one entity are related to another.
Types include:
• 1 : 1 → One object related to one object
• 1 : N → One object related to many objects
• M : N → Many objects related to many objects
Cardinality is important in query optimization because it helps estimate the size of intermediate results.

Explain Centralized Query Optimization


Ans: Centralized query optimization is the process of optimizing queries in a centralized DBMS where all data is stored
at a single site.
Main Steps
1. Parsing and Translation
• SQL query is checked for syntax and semantics
• Converted into relational algebra expression
2. Query Optimization
• Different execution plans are generated
• Best plan is selected using statistics about data
3. Execution Plan Generation
• Optimized relational algebra operations are arranged into an execution strategy
4. Query Execution
• Query execution engine executes the optimized plan on the database

Q7. Justify the following statements:


(a) Unique timestamp generation is difficult in DDBMS than centralized DBMS.
Ans: A timestamp is a unique identifier assigned to a transaction to determine its execution order.
In a centralized DBMS, timestamps can easily be generated using:
• A global counter
• System clock/date-time value
Since only one system exists, maintaining uniqueness and ordering is simple.
However, in a Distributed DBMS (DDBMS), timestamp generation becomes difficult because:
• Multiple sites generate transactions independently
• Each site has its own local clock
• Clocks may not be synchronized
• Same timestamp may be generated at different sites
To solve this, DDBMS generally uses:
⟨local timestamp, site identifier⟩
The site identifier is attached to the local timestamp to ensure global uniqueness.

Thus, generating globally ordered unique timestamps is more complex in DDBMS than in centralized DBMS.

You might also like