CC105 Flashcards
translate the logical description of data into the technical specifications for storing and retrieving data.
Purpose
create a design for storing data that will provide adequate performance and insure database integrity, security and recoverability.
Goal
smallest unit of data in database.
Field
Field design
Choosing data type.
Coding, compression, encryption.
Controlling data integrity.
Choosing Data Types
CHAR
VARCHAR2
LONG
NUMBER
DATE
BLOB
fixed-length character.
CHAR
variable-length character (memo).
VARCHAR2
large number.
LONG
positive/negative number
NUMBER
actual date.
DATE
binary large object (good for graphics, sound clips, etc.).
BLOB
Field Data Integrity
Default value
Range control
Null value control
Referential integrity
assumed value if no explicit value.
Default value
allowable value limitations (constraints or validation rules).
Range control
allowing or prohibiting empty fields.
Null value control
range control (and null value allowances) for foreign-key to primary key match-ups.
Referential integrity
- Substitute an estimate of the missing value (e.g. using a formula).
- Construct a report listing missing values.
Handling Missing Data
A group of fields stored in adjacent memory locations and retrieved together as a unit.
Physical Record
The amount of data read or written in one I/O operation.
Page
The number of physical records per page.
Blocking Factor
Transforming normalized relations into un-normalized physical record specifications
Denormalization
Common denormalization opportunities.
o One-to-one relationship.
o Many-to-many relationship with attributes.
o Reference data (1:N relationship where 1-side has data not used in any other relationship).
often correspond with User Schemas (user views)
Partitions
- Distributing the rows of a table into several separate files.
- Useful for situations where different users need access to different rows.
Horizontal Partitioning
Three types of Horizontal Partitioning
Key Range Partitioning,
Hash Partitioning,
Composite Partitioning.
- Distributing the columns of a table into several separate files.
- Useful for situations where different users need access to different columns.
Vertical Partitioning
Advantages of Partitioning:
Records used together are grouped together.
Each partition can be optimized for performance.
Security, recovery.
Partitions stored on different disks: contention.
Take advantage of parallel processing capability.
Disadvantages of Partitioning:
Slow retrievals across partitions.
Complexity.
- Purposely storing the same data in multiple locations of the database.
- Improves performance by allowing multiple users to access the same data at the same time with minimum
contention.
Data Replication
A named portion of secondary memory allocated for the purpose of storing physical records.
Physical File
Constructs to link two pieces of data:
o Sequential storage.
o Pointers.
How the files are arranged on the disk.
File Organization
How the data can be retrieved based on the file organization.
Access Method
Records of the file are stored in sequence by the primary key field values
Sequential file organization
a separate table that contains organization of records for quick retrieval.
Index
are automatically indexed.
Primary keys
has a CREATE INDEX operation
Oracle
allows indexes to be created for most field types.
MS ACCESS
Indexing approaches:
o B-tree index.
o Bitmap index.
o Hash Index.
o Join Index
Leaves of the tree are all at same level consistent access time.
B-tree index
saves on space requirements
Bitmap
possible values of the attribute.
Rows
table rows.
Columns
indicates whether the attribute of a row has the values
Bit
- In some relational DBMSs, related records from different tables can be stored together in the same disk area.
- Useful for improving performance of join operations.
Clustering Files
Rules for Using Indexes
- Use on larger tables.
- Index the primary key of each table.
- Index search fields (fields frequently in WHERE clause).
- Fields in SQL ORDER BY and GROUP BY commands.
- When there are >100 values but not when there are.
- DBMS may have limit on number of indexes per table and number of bytes per indexed field(s).
- Null values will not be referenced from an index.
- Use indexes heavily for non-volatile databases; limit the use of indexes for volatile databases.
Why? Because modifications (e.g. inserts, deletes) require updates to occur in index files.
A set of disk drives that appear to the user to be a single disk drive.
RAID
RAID stands for?
Redundant Array of Inexpensive Disks.
- Maximized parallelism.
- No redundancy.
Raid 0
- Redundant data – fault tolerant.
- Most common form.
Raid 1
- No redundancy.
- One record spans across data disks.
Raid 2
- Error correction in one disk.
- Record spans multiple data disks (more than RAID2).
Raid 3
- Error correction in one disk.
- Multiple records per stripe.
Raid 4
- Rotating parity array.
- Error correction takes place in same disks as data storage.
Raid 5
Query Optimization
Parallel Query Processing.
Override Automatic Query Optimization.
Data Block Size – Performance tradeoffs:
Balancing I/O across Disk Controllers.
Wise use of indexes.
Compatible data types.
Simple queries.
Avoid query nesting.
Temporary tables for query groups.
Select only needed columns.
No sort without index
Data Block Size – Performance tradeoffs:
o Block contention.
o Random vs. sequential row access speed.
o Row size.
o Overhead.
SQL stands for
Structured Query Language.