INFORMIX
Informix Guide to SQL: Tutorial
Chapter 1: Informix Databases
Home Contents Index Master Index New Book

The Data Illustration of a Data Model

The principal difference between information collected in a database versus information collected in a file is the way the data is organized. A flat file is organized physically; certain items precede or follow other items. But the contents of a database are organized according to a data model. A data model is a plan, or map, that defines the units of data and specifies how each unit is related to the others.

For example, a number can appear in either a file or a database. In a file, it is simply a number that occurs at a certain point in the file. A number in a database, however, has a role that the data model assigns to it. It might be a price that is associated with a product that was sold as one item of an order that was placed by a customer. Each of these components, price, product, item, order, and customer, also has a role that the data model specifies. See Figure 1-1.

The data model is designed when the database is created. Units of data are then inserted according to the plan that the model lays out. Some books use the term schema instead of data model.

Figure 1-1
The Advantage of Using a Data Model

Storing Data

Another difference between a database and a file is that the organization of the database is stored with the database.

A file can have a complex inner structure, but the definition of that structure is not within the file; it is in the programs that create or use the file. For example, a document file that a word-processing program stores might contain very detailed structures describing the format of the document. However, only the word-processing program can decipher the contents of the file because the structure is defined within the program, not within the file.

A data model, however, is contained in the database it describes. It travels with the database and is available to any program that uses the database. The model defines not only the names of the data items but also their data types, so a program can adapt itself to the database. For example, a program can find out that, in the current database, a price item is a decimal number with eight digits, two to the right of the decimal point; then it can allocate storage for a number of that type. How programs work with databases is the subject of Chapter 5, "Programming with SQL," and Chapter 6, "Modifying Data Through SQL Programs."

Querying Data

Another difference between a database and a file is the way you can interrogate them. You can search a file sequentially, looking for particular values at particular physical locations in each line or record. That is, you might ask a file, "What records have numbers under 20 in the fifth field?" Figure 1-2 shows this type of search.

Figure 1-2
Searching a File Sequentially

In contrast, when you query a database, you use the terms that its model defines. You can query the database with questions such as, "What orders have been placed for products made by the Shimara Corporation, by customers in New Jersey, with ship dates in the third quarter?" Figure 1-3 shows this type of query.

In other words, when you interrogate data that is stored in a file, you must state your question in terms of the physical layout of the file. When you query a database, you can ignore the arcane details of computer storage and state your query in terms that reflect the real world, at least to the extent that the data model reflects the real world.

In this manual, Chapter 2 and Chapter 3 describe the language you use for making queries. Chapter 8 and Chapter 9 describe how to design an accurate, robust data model for other users to query.

Figure 1-3
Querying a Database

Modifying Data

The model also makes it possible to modify the contents of the database with less chance for error. You can query the database with statements such as "Find every stock item with a manufacturer of Presta or Schraeder, and increase its price by 13 percent." You state changes in terms that reflect the meaning of the data. You do not have to waste time and effort thinking about details of fields within records in a file, so the chances for error are less.

The statements you use to modify stored data are covered in Chapter 5, "Programming with SQL."

Concurrent Use and Security

A database can be a common resource for many users. Multiple users can query and modify a database simultaneously. The database server (the program that manages the contents of all databases) ensures that the queries and modifications are done in sequence and without conflict.

Having concurrent users on a database provides great advantages but also introduces new problems of security and privacy. Some databases are private; individuals set them up for their own use. Other databases contain confidential material that must be shared but among only a select group of persons; still other databases provide public access.

Informix database software provides the means to control database use. When you design a database, you can perform any of the following functions:

The facilities that make these and other things possible are discussed in Chapter 11, "Granting and Limiting Access to Your Database."

Centralized Management

Databases that are used by many people are highly valuable and must be protected as important business assets. Compiling a store of valuable data and simultaneously allowing many employees to access it creates a significant problem: protecting data while maintaining performance. INFORMIX-Universal Server lets you centralize these tasks.

Databases must be guarded against loss or damage. The hazards are many: failures in software and hardware, and the risks of fire, flood, and other natural disasters. Losing an important database creates a huge potential for damage. The damage could include not only the expense and difficulty of re-creating the lost data but also the loss of productive time by the database users as well as the loss of business and good will while users cannot work. A plan for regular backups helps avoid or mitigate these potential disasters.

A large database used by many people must be maintained and tuned. Someone must monitor its use of system resources, chart its growth, anticipate bottlenecks, and plan for expansion. Users will report problems in the application programs; someone must diagnose these problems and correct them. If rapid response is important, someone must analyze the performance of the system and find the causes of slow responses.

INFORMIX-Universal Server Databases

Universal Server is designed to manage large databases with requirements for high reliability, high availability, and high performance. Although Universal Server supports private and group databases very well, it is at its best managing the databases that are essential for your organization to carry out its work.

Universal Server lets you make backups while the databases are in use. It also allows incremental backups (backing up only modified data), an important feature when you are making a complete copy that could take many tapes.

Universal Server has an interactive monitor program that lets its operator (or any user) monitor the activities within the database server to see when bottlenecks are developing. It also comes with utility programs to analyze its use of disk storage. In addition, Universal Server provides the sysmaster tables that contain information about an entire database server, which might manage many databases. For more information about the sysmaster tables, see the INFORMIX-Universal Server Administrator's Guide.

The INFORMIX-Universal Server Performance Guide contains tips on optimizing placement of tables on disk. All the details of using and managing Universal Server are contained in the INFORMIX-Universal Server Administrator's Guide.




Informix Guide to SQL: Tutorial, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.