Distributed Database
Distributed Database
Qurat-ul-Ain 2620
Roll NO=2600
Database
• A database is a collection of information that is organized
so that it can easily be access, manage, and update.
• Facebook . . .
Distributed computing system
P1 NETWORK P3
P2
Distributed Database
DDBMS
Homogenous Heterogeneous
Homogenous Distributed Database Systems
2519
Database Tuning
Database tuning is a group of activities used to optimize the
performance of a database
Activity of making a database application run faster:
– Faster means higher throughput (or response
time)
Probable Causes
Large Tables
Bad coding.
AIM:-
• Get best system throughput with available/minimum
resources.
Why Performance Tuning
• Avoid unnecessary investment in additional
hardware/development effort.
• Better system throughput
-implies better productivity.
• Better productivity
-implies better service.
Tuning Strategy
Who?
Application designer
Application developer
Database
administrator
System administrator
Network
administrator
Tuning Strategy
Why?
Business rules
Business Design Implementation Management
procedure
Database
system and
Business Application Application Network
executive Designer Developer administrat
or
Where Should We Do The Tuning.
OS
Tuning
Hunzah Naz
2503
What is Database Tuning?
• Database tuning is a group of activities used to optimize the
performance of a database.
• Goal Of Database Tuning?
To maximize use of system resources
To perform task as efficiently
To work rapidly as possible
Why and when should one tune?
• Slow Physical I/O
-caused by poorly-configured disks
-caused by unnecessary physical I/O
-caused by poorly-tuned SQL.
• Excessive CPU usage
-It means that there is little idle CPU on the system
-caused by an inadequately-sized system,
-caused by untuned SQLstatements
-caused inefficient application programs.
• Latch Contention
Rarely is latch contention tunable by reconfiguring the instance. Rather, latch contention usually is resolved through application
changes.
Causes for low Performance
• Bad Connection Management
• Bad Use of Cursors and the Shared Pool
• Bad SQL
• Use of Nonstandard Initialization Parameters
• Getting Database I/O Wrong
• Redo Log Setup Problems
• Long Full Table Scans
• High Amounts of Recursive (SYS) SQL
Where should we do the tuning?
• Database Design
Poor system performance usually results from a poor
database design.
One should generally normalize to the 3NF.
Selective denormalization can provide valuable
performance improvements..
Application Tuning:
2620
What is Database?
• A database is an organized collection of data. It is collection of
schemas, table, queries, views and other objects.
Issues in Database Performance
• Performance in Read / write are hardware issues => throw money at it
• Performance of DB = ability of engine to locate data
• Factors affecting speed of retrieval
• Cache (sizing of objects)
• Access method (table scan / indexes…)
• Contention between processes
• Indirect processes (roll back, archiving…)
Reading data in Oracle
1 – determine how to access block where data is located
• read data dictionary stored in separate part of DB
• DD may be loaded up in cache (aka row cache) to limit I/O activity
2 - DD indicates preferred access method for block
• B tree index, partitioning, hash clusters etc…
3 - Search begins either in full scan or with index until data found
Designing DB for reading
• Supply methods for high precision access to data
• But some queries will defeat the strategies
• E.g. credit cards transactions – monthly report of scattered items
• No solution = take off-line
Changing data
• Oracle makes hard work of changes
• Rollback data (immediate)
• Log files (long term)
• Changed blocks read and updated in buffer
• Released to disk as buffer is cleared
• But rollback info generate most I/O operations
Indexing Problems
• Super-fast indexes need updating as data is changed => DB slows
down.
• DB physical structure degrades, so does index (e.g split blocks)
• Performance decreases over time
• Rebuild needed
Side effects
• Role of DBMS enforce data consistency
• A reading process may need an older version of the data
• Need to create a private version of the data
Solution
• To create an older version of data
• Must apply roll back
• find old roll back block (I/O)
• Roll back index (I/O)
• Find data (I/O)
• Roll back data
• Read old data
• Reverse all changes (multiple I/O)
• Significant I/O implications + buffer full of old stuff
Conclusions
• Writers and readers DO interfere with each other
• The mechanisms used by Oracle to bypass locking have
performance side effects
• Performance come with minimising I/O
• i.e. with good access techniques
• Precision of data location
• Physical proximity of related data
Hafiza Shumaila Noor
2521
SQL
The Structured Query Language
SQL
The ANSI standard language for the definition and
manipulation of relational database.
SQL statements are used to perform task such as update data
on a database, or retrieve data from a database.
SQL data is case-sensitive, SQL commands are not.
SQL is not a programming language, it is a Data Manipulation
language.
SQL
Create
Standard commands Insert
SQL
DDL DML
DDL
Alter
DDL
CREATE:
Things to consider before you create your table are:
The type of data
the table name
what column will make up the primary key
the names of the columns
DDL
ALTER:
To add or drop columns on existing tables.
Drop:
Delete objects from the Database
Data Manipulation language
Insert Delete
DML
Update
DML
INSERT:
To insert a row into a table, it is necessary to have a
value for each attribute, and order matters.
Update:
Updates existing data within a table.
SELECT
Retrieve data from the Database.
DML
DELETE:
Used to delete objects from the database.
Faran Khurshid
2590