SQL DDL
-
Upload
linda-reese -
Category
Documents
-
view
30 -
download
0
description
Transcript of SQL DDL
DBST 652 3-1
SQL DDLSQL DDL
• Language used to define objects such as tables,
indexes, primary keys, foreign keys
• Used by most relational databases
DBST 652 3-4
SQL2 Statements Defining COMPANY Schema (1)SQL2 Statements Defining COMPANY Schema (1)
Elmasri, p. 245
DBST 652 3-6
Specifying Referential Triggered ActionsSpecifying Referential Triggered Actions
Elmasri, p. 248
DBST 652 3-7
SQL DDLSQL DDL
• Look in workbook at p. 22 and 27
• Translated ERD to DDL
• Look at structure of scripts – spool, drops,
creates, query catalog.
DBST 652 3-8
SQL DDLSQL DDL
• Space gets allocated on disks so we need to pay
attention to disk structure
• DBA may have to “place” objects (today)
DBST 652 3-9
Why important for us?Why important for us?
• When we use DDL and say CREATE TABLE or
CREATE INDEX, what happens?
• What options does the engine provide?
• Different engines may provide ability to control
data storage option or index option
DBST 652 3-14
Tracks divided into Blocks Tracks divided into Blocks
• Blocks is where database people get involved
because
• 1. It is our unit of I/O (could be multiblock)
• 2. We use it as our sizing unit
• Disks are where we place objects
• Assume dbcourse2 has 2k blocks
DBST 652 3-15
Winchester Disk Track Format (Seagate ST506)Winchester Disk Track Format (Seagate ST506)
Stallings, p. 157
DBST 652 3-17
Group of Sectors That Subtend the Same AngleGroup of Sectors That Subtend the Same Angle
Elmasri, p. 469
DBST 652 3-18
Interleaved vs. Simultaneous ConcurrencyInterleaved vs. Simultaneous Concurrency
Elmasri, p. 474
DBST 652 3-19
Double bufferingDouble buffering
• Shown on next slide
• cpu starts processing a block once transfer to
main memory is completed
• at same time - disk I/O processor can be reading
and transferring the next block into a different
buffer
DBST 652 3-20
Use of Two Buffers for Reading from DiskUse of Two Buffers for Reading from Disk
Elmasri, p. 474
DBST 652 3-21
Double bufferingDouble buffering
• “…Eliminates seek time and rotational delay for
all but first block”
• So…improves performance!