0% found this document useful (0 votes)
3 views

Database Management System Chapter 2

Uploaded by

mfalturki
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Database Management System Chapter 2

Uploaded by

mfalturki
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

CHAPTER 16

Disk Storage, Basic File Structures,


Hashing, and Modern Storage
Architectures

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe


Outline
 Data Representation
 System Catalogs
 Storage Models

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 2


Data Representation
 A tuple is essentially a sequence of bytes.
 It's the job of the DBMS to interpret those bytes
into attribute types and values.
 The DBMS's catalogs contain the schema
information about tables that the system uses to
figure out the tuple's layout.

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 3


Data Representation
 INTEGER/BIGINT/SMALLINT/TINYINT
 C/C++ Representation
 FLOAT/REAL vs. NUMERIC/DECIMAL
 IEEE-754 Standard / Fixed-point Decimals
 VARCHAR/VARBINARY/TEXT/BLOB
 Header with length, followed by data bytes.
 TIME/DATE/TIMESTAMP
 32/64-bit integer of (micro)seconds since Unix
epoch

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 4


Data Representation
 Variable Precision Numbers
 Inexact, variable-precision numeric type that uses
the "native" C/C++ types.
 Faster than Fixed-precision numbers
 Example: FLOAT, REAL/DOUBLE
 Fixed Precision Numbers
 Numeric data types with arbitrary precision and
scale.
 Used when round errors are unacceptable.
 Example: NUMERIC, DECIMAL

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 5


Variable Precision Numbers

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 6


Outline
 Data Representation
 System Catalogs
 Storage Models

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 7


System Catalogs
 A DBMS stores meta-data about databases in its
internal catalogs.
 Tables, columns, indexes, views
 Users, permissions
 Internal statistics
 You can query the DBMS’s internal catalog to get
info about the database

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 8


Outline
 Data Representation
 System Catalogs
 Storage Models

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 9


Storage Model
 The relational model does not specify that we
have to store all of a tuple's attributes together in
a single page.
 This may not actually be the best layout for some
workloads

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 10


Workload Characterization

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 11


OLTP
 On-line Transaction Processing:
 Simple queries that read/update a small amount of
data that is related to a single entity in the
database.

 This is usually the kind of


application that people
build first.

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 12


OLAP
 On-line Analytical Processing:
 Complex queries that read large portions of the
database spanning multiple entities.
 You execute these workloads on the data you
have collected from your OLTP application(s).

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 13


Storage Models
 The DBMS can store tuples in different ways that
are better for either OLTP or OLAP workloads.
 We have been assuming the row storage model.

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 14


Row Storage Model
 The DBMS stores all attributes for a single tuple
contiguously in a page.
 Ideal for OLTP workloads where queries tend to
operate only on an individual entity and insert-
heavy workloads.

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 15


Row Storage Model
 Advantages
 Fast inserts, updates, and deletes.
 Good for queries that need the entire tuple.
 Disadvantages
 Not good for scanning large portions of the table
and/or a subset of the attributes.

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 16


Column Storage Model
 The DBMS stores the values of a single attribute
for all tuples contiguously in a page.
 Also known as a "column store".
 Ideal for OLAP workloads where read-only
queries perform large scans over a subset of the
table’s attributes.

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 17


Column Storage Model

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 18


Column Storage Model
 Advantages
 Reduces the amount wasted I/O because the
DBMS only reads the data that it needs.
 Better query processing and data compression.
 Disadvantages
 Slow for point queries, inserts, updates, and
deletes because of tuple splitting/stitching.

Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Slide 16- 19

You might also like