1 / 30

File Processing

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

Download Presentation

File Processing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

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

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

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

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

  7. EMP ENO ENAME TITLE E1 J. Doe Elect. Eng. E2 M. Smith Syst. Anal. E3 A. Lee Mech. Eng. E4 J. Miller Programmer E5 B. Casey Syst. Anal. E6 L. Chu Elect. Eng. E7 R. Davis Mech. Eng. E8 J. Jones Syst. Anal. PROJ PNO PNAME BUDGET P1 Instrumentation 150000 P2 Database Develop. 135000 P3 CAD/CAM 250000 P4 Maintenance 310000 P5 CAD/CAM 500000 Example Relation Instances WORKS ENO PNO RESP DUR E1 P1 Manager 12 E2 P1 Analyst 24 E2 P2 Analyst 6 E3 P3 Consultant 10 E3 P4 Engineer 48 E4 P2 Programmer 18 E5 P2 Manager 24 E6 P4 Manager 48 E7 P3 Engineer 36 E7 P5 Engineer 23 E8 P3 Manager 40

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

  9. Why Database Technology • Programmer productivity • High data independence Total System Cost

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

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

  12. Database Functionality (cont’d) • Declarative access • Query language • SQL • Find the names of all electrical engineers. SELECT ENAME FROM EMP WHERE TITLE = “Elect. Eng.” • Find the names of all employees who have worked on a project as a manager for more than 12 months. SELECT EMP.ENAME FROM EMP,ASG WHERE RESP = “Manager” AND DUR > 12 AND EMP.ENO = ASG.ENO

  13. Database Functionality (cont’d) • System determined execution • Query optimizer • Relational algebra • Find the names of all electrical engineers. PROJECTENAME(SELECTTITLE = “Elect. Eng.”EMP) • Find the names of all employees who have worked on a project as a manager for more than 12 months. PROJECTENAME(SELECTRESP=“Manager” AND DUR>12(EMP JOINENO ASG)

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

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

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

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

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

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

  20. DBMS Architecture • DBMS Interfaces • Menu-based Interface • Graphical Interface • Forms-based Interface • Interface for DBA

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

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

  23. Conceptual Schema 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)

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

  25. Internal Schema 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]

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

  27. External Schema 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

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

  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. 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.

More Related