Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 File Processing n Data are stored in files with interface between programs and files. n Various access methods exist (e.g., Sequential, indexed, random)

Similar presentations


Presentation on theme: "1 File Processing n Data are stored in files with interface between programs and files. n Various access methods exist (e.g., Sequential, indexed, random)"— Presentation transcript:

1 1 File Processing n Data are stored in files with interface between programs and files. n Various access methods exist (e.g., Sequential, indexed, random) n One file corresponds to one or several programs. PROGRAM 1 Data Management FILE 1 FILE 2 Redundant Data PROGRAM 2 Data Management PROGRAM 3 Data Management File System Services

2 2 Problems With File Systems n Data are still high redundant l sharing limited and at the file level n Data is unstructured l “flat” files n High maintenance costs l data dependence; accessing data is difficult l ensuring data consistency and controlling access to data n Sharing granularity is very coarse n Difficulties in developing new applications

3 3 PROGRAM 1 PROGRAM 2 Integrated Database DBMS Query Processor Transaction Mgr … Database Approach

4 4 What is a Database? n A database is an integrated and structured collection of stored operational data used (shared) by application systems of an enterprise

5 5 What is a Database? n A database (DB) is a structured collection of data about the entities that exist in the environment that is being modeled. n The structure of the database is determined by the data model that is used. n A database management system (DBMS) is the generalized tool that facilitates the management of and access to the database.

6 6 Data Model n Formalism that defines how data are organized l Within a file l Between files n File systems can at best specify data organization within one file n Alternatives l Old ones (hierarchical, network) l Relational l Object-oriented

7 7 Example Relation Instances ENOENAMETITLE E1J. DoeElect. Eng. E2M. SmithSyst. Anal. E3A. LeeMech. Eng. E4J. MillerProgrammer E5B. CaseySyst. Anal. E6L. ChuElect. Eng. E7R. DavisMech. Eng. E8J. JonesSyst. Anal. EMP ENOPNORESP E1P1Manager12 DUR E2P1Analyst24 E2P2Analyst 6 E3P3Consultant10 E3P4Engineer48 E4P2Programmer18 E5P2Manager24 E6P4Manager48 E7P3Engineer36 E8P3Manager40 WORKS E7P5Engineer23 PROJ PNOPNAMEBUDGET P1Instrumentation150000 P3CAD/CAM250000 P2Database Develop.135000 P4Maintenance310000 P5CAD/CAM500000

8 8 Data constitute an organizational asset  Integrated control l Reduction of redundancy l Avoidance of inconsistency l Sharability l Standards l Improved security l Integrity l integrated  centralized Programmer productivity  Data Independence Why Database Technology

9 9 n Programmer productivity l High data independence Why Database Technology Total System Cost

10 10 n Invisibility (transparency) of the details of conceptual organization, storage structure and access strategy to the users l Logical à transparency of the conceptual organization à transparency of logical access strategy l Physical à transparency of the physical storage organization à transparency of physical access paths Data Independence

11 11 Database Functionality n Integrated schema l Users have uniform view of data l They see things only as relations (tables) in the relational model n Declarative integrity and consistency enforcement l 24000  Salary  250000 l No employee can have a salary greater than his/her manager. l User specifies and system enforces. n Individualized views l Restrictions to certain relations l Reorganization of relations for certain classes of users

12 12 Database Functionality (cont’d) n Declarative access l Query language l SQL à Find the names of all electrical engineers. SELECTENAME FROMEMP WHERETITLE = “Elect. Eng.” à Find the names of all employees who have worked on a project as a manager for more than 12 months. SELECTEMP.ENAME FROMEMP,ASG WHERERESP = “Manager” ANDDUR > 12 ANDEMP.ENO = ASG.ENO

13 13 Database Functionality (cont’d) n System determined execution l Query optimizer l Relational algebra à Find the names of all electrical engineers. PROJECT ENAME (SELECT TITLE = “Elect. Eng.” EMP) à Find the names of all employees who have worked on a project as a manager for more than 12 months. PROJECT ENAME (SELECT RESP=“Manager” AND DUR>12 (EMP JOIN ENO ASG)

14 14 Database Functionality (cont’d) n Transactions l Execute user requests as atomic units l May contain one query or multiple queries l Provide à Concurrency transparency F Multiple users may access the database, but they each see the database as their own personal data F Concurrency control à Failure transparency F Even when system failure occurs, database consistency is not violated F Logging and recovery

15 15 Database Functionality (cont’d) n Transaction Properties l Atomicity à All-or-nothing property l Consistency à Each transaction is correct and does not violate database consistency l Isolation à Concurrent transactions do not interfere with each other l Durability à Once the transaction completes its work (commits), its effects are guaranteed to be reflected in the database regardless of what may occur

16 16 G.C. Everest. Database Management, McGraw Hill, 1986 Role in an Information System

17 17 Application Programs Operating System DBMS App. development tools Hardware Place in a Computer System

18 18 H.F. Korth and A. Silberschatz. Database System Concepts, McGraw-Hill, 1986. System Structure data manipulation language precompiler query processor data definition language compiler application program object code database manager application programs query database scheme system calls naive users application programmers casual users database administrator data files data dictionary file manager DBMS

19 19 DBMS Architecture n DBMS Languages l Data Definition Language (DDL) à defines conceptual schema, external schema, and internal schema, as well as mappings between them. l Data Manipulation Language (DML) à embedded query language in a host language à “stand-alone” query language l Procedural vs. non-procedural à Procedural: specify where and how à Non-procedural: specify what

20 20 DBMS Architecture n DBMS Interfaces l Menu-based Interface l Graphical Interface l Forms-based Interface l Interface for DBA

21 21 DBMS Architecture n Main DBMS Modules l DDL compiler l DML compiler l Ad-hoc (interactive) query compiler l Run-time database processor l Stored Data Manager l Concurrency/back-up/recovery subsystem

22 22 ANSI/SPARC Architecture External Schema Conceptual Schema Internal Schema Internal view Conceptual view External view External view External view Users DBMS

23 23 ENTITY ENGINEER [ ATTRIBUTES = { ENG-NO:CHARACTER(9) ENG-NAME :CHARACTER(15) TITLE : CHARACTER(10) SALARY : NUMERIC(6)} KEY = {ENG-NO}] ENGINEER(ENG-NO,ENG-NAME,TITLE,SALARY) ENTITY PROJECT [ ATTRIBUTES = { PROJ-NO : CHARACTER(7) PROJ-NAME : CHARACTER(20) BUDGET : NUMERIC(7)} KEY = {PROJ-NO)] PROJECT(PROJ-NO,PROJ-NAME,BUDGET) Conceptual Schema

24 24 RELATIONSHIP WORKS_IN [ BETWEEN = (ENGINEER, PROJECT} ATTRIBUTES = { RESP : CHARACTER(10) DURATION : NUMERIC(3) } ] WORKS_IN(ENG-NO,PROJ-NO,RESP,DURATION) Conceptual Schema

25 25 ENTITY ENGINEER [ ATTRIBUTES = { ENG-NO: CHARACTER(9) ENG-NAME: CHARACTER(15) TITLE : CHARACTER(10) SALARY : NUMERIC(6)} KEY = {ENGINEER_NUMBER}]  FILE ENG [ INDEX ON E# CALL EMINX FIELD = { E#: BYTE(9) ENAME: BYTE(15) TIT: BYTE(10) SALARY : INTEGER(6)} BLOCKING FACTOR 100] Internal Schema

26 26 Create an BUDGET view from the PROJECT entity. CREATEVIEWBUDGET (PNAME, BUD) AS SELECT PROJ-NAME, BUDGET FROM PROJECT External Schema

27 27 Create an ASSIGNMENT view from the entities ENGINEER and PROJECT that show the names of engineers and the projects that they work on. CREATE VIEW ASSIGNMENT(ENO,PNO,ENAME,PNAME) AS SELECT ENGINEER.ENG-NO,ENGINEER.ENG-NAME, PROJECT.PROJ-NO,PROJECT.PROJ-NAME FROM ENGINEER,PROJECT,WORKS_IN WHERE ENGINEER.ENG-NO = WORKS_IN.ENG-NO AND WORKS_IN.PROJ-NO = PROJECT.PROJ-NO External Schema

28 28 DBMS System Buffer User Program A Language User Work Area (UWA) external schema used by user program A Schema Physical/Internal Data Schema Operating System Database 1 2 3 4 5 6 7 8 9 10 Database Access (DBMS)

29 29 Database Access ¶ User program A sends to DBMS an invoke command to retrieve a (set of) record · DBMS analyzes the external schema of the user program A and finds the database description of the record. ¸ DBMS checks with the schema to get the data types and location information of record ¹ DBMS checks with the physical schema to find out which device the record is in and what access methods can be used. º According to 4, DBMS sends OS a read command to execute the search.

30 30 Database Access » OS issues the page invoke command to the correspond device, and then puts the page fetched into the system buffer. ¼ DBMS uses the schema and the external schema to infer the logical structure of the retrieving record. ½ DBMS places the relevant data to the UWA, and ¾ provides the status information at the program invocation exit.


Download ppt "1 File Processing n Data are stored in files with interface between programs and files. n Various access methods exist (e.g., Sequential, indexed, random)"

Similar presentations


Ads by Google