0% found this document useful (0 votes)
2 views

Lesson2

The document provides an overview of database systems concepts and architecture, focusing on data models, three-tier architecture, data independence, and database languages. It categorizes data models into conceptual, representational, physical, and self-descriptive models, and discusses the importance of indexing and query optimization for efficient data access. Additionally, it outlines various database architectures and highlights the tools and utilities used in database management systems.

Uploaded by

Juan Pablo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lesson2

The document provides an overview of database systems concepts and architecture, focusing on data models, three-tier architecture, data independence, and database languages. It categorizes data models into conceptual, representational, physical, and self-descriptive models, and discusses the importance of indexing and query optimization for efficient data access. Additionally, it outlines various database architectures and highlights the tools and utilities used in database management systems.

Uploaded by

Juan Pablo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Database Systems Concepts and Architecture

Database architecture defines the organization and structure of


database systems. Its objective is to separate data representation
from its physical storage, providing independence and efficiency in
data management.
This chapter explores:
Data models and their categories.
The three-tier architecture.
Data independence.
Languages and tools used in databases.
Methods for optimizing search and data access.

Data Models
A data model is a set of concepts and rules that describe the
structure of a database, as well as its operations and constraints. It
allows for better organization, access, and retrieval of data while
ensuring consistency and integrity.
Categories of Data Models
1. Conceptual Models:
Represent data in a way that is close to how users perceive it.
Example: Entity-Relationship (E-R) Model.
Used mainly in database design to create a high-level representation
of the data structure.

Practical Example:

CREATE TABLE Student (


ID INT PRIMARY KEY,
Name VARCHAR(50),
Surname VARCHAR(50),
Major VARCHAR(50)
);

2. Representational Models (Implementation Models):


Used in commercial systems.
Based on tables with relationships using primary and foreign keys.
The relational model is the most commonly used, where data is
structured into tables.
Example:
INSERT INTO Student (ID, Name, Surname, Major) VALUES (1, 'Carlos',
'Gomez', 'Engineering');
SELECT * FROM Student;
This example demonstrates how relational databases use structured
data and relationships between tables to maintain consistency.

3. Physical Models:
Describe how data is stored and organized at the hardware level.
Include storage structures like files and data blocks.
Define strategies for efficient data access and retrieval.
Use indexes to optimize queries and improve search performance.
Example of using indexes for performance improvement:
CREATE INDEX idx_name ON Student(Name);
Indexes are essential in relational databases because they reduce
the time required for searching data, especially in large datasets.
Without indexes, the database must scan entire tables to locate
records.

4. Self-Descriptive Models:
Mix data with its description (metadata).
Example: XML, JSON, NoSQL.
Practical Example in JSON:
{
"ID": 1,
"Name": "Carlos",
"Surname": "Gomez",
"Major": "Engineering"
}
JSON databases, such as MongoDB, allow flexible and scalable storage
solutions, especially for web applications.

Three-Tier Architecture
1. Internal Level: Defines the physical storage structure.
2. Conceptual Level: Describes the logical organization of the
database.
3. External Level: Provides different views for users.

Example in SQL (external view):


CREATE VIEW ClientView AS SELECT Name, Email FROM Client;
SELECT * FROM ClientView;
Views allow the abstraction of underlying tables, providing a
simplified or restricted version of data for specific users

Data Independence
Logical Independence: Changes in the conceptual schema
without affecting applications.
Physical Independence: Changes in storage without affecting
the logical structure.
Example in SQL
ALTER TABLE Client ADD Phone VARCHAR(15);
This modification adds a new column to the table without altering
existing applications or queries.

Database Languages
1. DDL (Data Definition Language):
Defines the database structure. Used for creating and modifying tables.

CREATE TABLE Product (


ID INT PRIMARY KEY,
Name VARCHAR(50)
);
2. DML (Data Manipulation Language):
 Allows inserting, updating, and deleting data.
UPDATE Client SET Email = '[email protected]' WHERE ID = 1;
3. Query Languages (SQL):
 Used to retrieve data.
SELECT * FROM Product;
Indexing and Optimization
Indexes are structures that accelerate data search and retrieval.
 B-Trees Indexes: Used in relational databases for efficient
queries.
 Hash Indexes: Ideal for exact searches.
 Clustered and Non-Clustered Indexes: Data organization
within system pages.
Example of creating an index:
CREATE INDEX idx_surname ON Student(Surname);
This index improves search speed for students by surname,
reducing query time significantly.

Query Optimization
Modern databases include optimization mechanisms such as:
 Query Planning: Choosing the best execution method.
 Caching: Storing results of frequent queries.
 Parallelization: Splitting queries into multiple processes.

Example of analyzing a query execution:


EXPLAIN ANALYZE SELECT * FROM Student WHERE Surname =
'Gomez';
This command helps database administrators identify bottlenecks
and optimize performance.

Database Architectures
Centralized: A single server manages the database.
Two-Tier Client/Server:
Client handles the interface.
Server manages the database.
Three-Tier Client/Server:
An application server is introduced.
Distributed Systems:
Data is distributed across multiple servers.
Database Management System (DBMS) Tools and Utilities
Backup and recovery.
Performance monitoring.
Query optimization.
Metadata management.
Example of Backup in MySQL:

mysqldump -u user -p database_name > backup.sql

Backing up databases is essential for data integrity and disaster


recovery.

You might also like