(1) Insertion/Deletion - PowerPoint PPT Presentation

About This Presentation
Title:

(1) Insertion/Deletion

Description:

Title: CS 245: Database System Principles Author: Siroker Last modified by: Elke Created Date: 7/13/1999 7:55:20 PM Document presentation format: On-screen Show (4:3) – PowerPoint PPT presentation

Number of Views:58
Avg rating:3.0/5.0
Slides: 26
Provided by: Siroker
Learn more at: http://web.cs.wpi.edu
Category:

less

Transcript and Presenter's Notes

Title: (1) Insertion/Deletion


1
Other Topics
  • (1) Insertion/Deletion
  • (2) Buffer Management
  • (3) Comparison of Schemes

2
Deletion
  • Block

Rx
3
Options
  • (a) Immediately reclaim space
  • (b) Mark deleted

4
Options
  • (a) Immediately reclaim space
  • (b) Mark deleted
  • May need chain of deleted records
  • (for re-use)
  • Need a way to mark
  • special characters
  • delete field
  • in map

5
As usual, many tradeoffs...
  • How expensive is to move valid record to free
    space for immediate reclaim?
  • How much space is wasted?
  • e.g., deleted records, delete fields, free space
    chains,...

6
Concern with deletions
  • Dangling pointers

R1
?
7
Solution 1 Do not worry
8
Solution 2 Tombstones
  • E.g., Leave MARK in map or old location

9
Solution 2 Tombstones
  • E.g., Leave MARK in map or old location

10
Logical IDs
Solution 2 Tombstones
E.g., Leave MARK in map or old location
map
ID
LOC
Never reuse ID 7788 nor space in map...
7788
11
Insert
  • Easy case records not in sequence
  • ? Insert new record at end of file or in
    deleted slot
  • ? If records are variable size, not as
    easy...

12
Insert
  • Hard case records in sequence
  • ? If free space close by, not too bad...
  • ? Or use overflow idea...

13
Interesting problems
  • How much free space to leave in each block,
    track, cylinder?
  • How often do I reorganize file overflow?

14
Free space
15
Buffer Management
  • DB features needed
  • Policies LRU bad?
  • Pinned blocks
  • Forced output
  • Double buffering
  • Swizzling

in prior notes
16
Swizzling
  • Memory Disk

block 1
block 1
block 2
Rec A
17
Swizzling
  • Memory Disk

block 1
block 1
block 2
Rec A
18
Row vs Column Store
  • So far we assumed that fields of a record are
    stored contiguously (row store)...
  • Another option is to store like fields together
    (column store)

19
Row Store
  • Example Order table has schema
  • id, cust, prod, store, price, date, qty

20
Column Store
  • Example Order consists of
  • id, cust, prod, store, price, date, qty

ids may or may not be stored explicitly
21
Row vs Column Store
  • Advantages of Column Store
  • more compact storage (fields not at byte
    boundary)
  • replication/compression
  • efficient reads on data analytics/mining (OLAP)
  • Advantages of Row Store
  • writes (multiple fields of one record) more
    efficient
  • efficient reads for record access (OLTP)

22
Literature
  • Mike Stonebreaker, Elizabeth O'Neil, Pat ONeil,
    Xuedong Chen, et al. " C-Store A Column-oriented
    DBMS," VLDB Conference, 2005.
  • Commerialized as Vertica In (Boston!) also
    LucidDB, MonetDB, and others.

23
Comparison
  • There are 10,000,000 ways to organize my data on
    disk
  • Which is right for me?

24
Issues
  • Flexibility Space Utilization
  • Complexity Performance

25
  • To evaluate a given strategy, compute
    following parameters
  • -gt space used for expected data
  • -gt expected time to
  • - fetch record given key
  • - fetch record with next key
  • - insert record
  • - append record
  • - delete record
  • - update record
  • - read all file
  • - reorganize file
Write a Comment
User Comments (0)
About PowerShow.com