SlideShare une entreprise Scribd logo
1  sur  26
Free Ebooks Download
Mba Ebooks
By Edhole
Mba ebooks
Free ebooks download
http://ebooks.edhole.com
File Organizations and Indexing
Lecture 4
R&G Chapter 8
"If you don't find it in the index, look very
carefully through the entire catalogue."
-- Sears, Roebuck, and Co.,
Consumer's Guide, 1897
http://ebooks.edhole.com
Context
Query Optimization
and Execution
Relational Operators
Files and Access Methods
Buffer Management
Disk Space Management
DB
http://ebooks.edhole.com
Alternative File Organizations
Many alternatives exist, each good for
some situations, and not so good in
others:
– Heap files: Suitable when typical access is
a file scan retrieving all records.
– Sorted Files: Best for retrieval in search key
order, or only a `range’ of records is
needed.
– Clustered Files (with Indexes): Coming
soon…
http://ebooks.edhole.com
Cost Model for Analysis
We ignore CPU costs, for simplicity:
– B: The number of data blocks
– R: Number of records per block
– D: (Average) time to read or write disk block
– Measuring number of block I/O’s ignores gains of
pre-fetching and sequential access; thus, even I/O
cost is only loosely approximated.
– Average-case analysis; based on several simplistic
assumptions.
Good enough to show the overall trends!
http://ebooks.edhole.com
Some Assumptions in the
Analysis
• Single record insert and delete.
• Equality selection - exactly one match
(what if more or less???).
• Heap Files:
– Insert always appends to end of file.
• Sorted Files:
– Files compacted after deletions.
– Selections on search key.
http://ebooks.edhole.com
Cost of
Operations
B: The number of data pages
R: Number of records per page
D: (Average) time to read or write disk page
Heap File Sorted File Clustered File
Scan all
records
Equality
Search
Range
Search
Insert
Delete
http://ebooks.edhole.com
Cost of
Operations
B: The number of data pages
R: Number of records per page
D: (Average) time to read or write disk page
Heap File Sorted File Clustered File
Scan all
records
BD BD
Equality
Search
Range
Search
Insert
Delete
http://ebooks.edhole.com
Cost of
Operations
B: The number of data pages
R: Number of records per page
D: (Average) time to read or write disk page
Heap File Sorted File Clustered File
Scan all
records
BD BD
Equality
Search
0.5 BD (log2 B) * D
Range
Search
Insert
Delete
http://ebooks.edhole.com
Cost of
Operations
B: The number of data pages
R: Number of records per page
D: (Average) time to read or write disk page
Heap File Sorted File Clustered File
Scan all
records
BD BD
Equality
Search
0.5 BD (log2 B) * D
Range
Search
BD [(log2 B) +
#match pg]*D
Insert
Delete
http://ebooks.edhole.com
Cost of
Operations
B: The number of data pages
R: Number of records per page
D: (Average) time to read or write disk page
Heap File Sorted File Clustered File
Scan all
records
BD BD
Equality
Search
0.5 BD (log2 B) * D
Range
Search
BD [(log2 B) +
#match pg]*D
Insert 2D ((log2B)+B)D
(because R,W 0.5)
Delete
http://ebooks.edhole.com
Cost of
Operations
B: The number of data pages
R: Number of records per page
D: (Average) time to read or write disk page
Heap File Sorted File Clustered File
Scan all
records
BD BD
Equality
Search
0.5 BD (log2 B) * D
Range
Search
BD [(log2 B) +
#match pg]*D
Insert 2D ((log2B)+B)D
Delete 0.5BD + D ((log2B)+B)D
(because R,W 0.5)
http://ebooks.edhole.com
Indexes
• Sometimes, we want to retrieve records by specifying
the values in one or more fields, e.g.,
– Find all students in the “CS” department
– Find all students with a gpa > 3
• An index on a file is a disk-based data structure that
speeds up selections on the search key fields for the
index.
– Any subset of the fields of a relation can be the search key
for an index on the relation.
– Search key is not the same as key (e.g. doesn’t have to be
unique ID).
• An index contains a collection of data entries, and
supports efficient retrieval of all records with a given
search key value k.
http://ebooks.edhole.com
First Question to Ask About
Indexes
• What kinds of selections do they support?
– Selections of form field <op> constant
– Equality selections (op is =)
– Range selections (op is one of <, >, <=, >=, BETWEEN)
– More exotic selections:
• 2-dimensional ranges (“east of Berkeley and west of Truckee
and North of Fresno and South of Eureka”)
– Or n-dimensional
• 2-dimensional distances (“within 2 miles of Soda Hall”)
– Or n-dimensional
• Ranking queries (“10 restaurants closest to Berkeley”)
• Regular expression matches, genome string matches, etc.
• One common n-dimensional index: R-tree
– Supported in Oracle and Informix
– See http://gist.cs.berkeley.edu for research on this topic
http://ebooks.edhole.com
Index Breakdown
• What selections does the index support
• Representation of data entries in index
– i.e., what kind of info is the index actually
storing?
– 3 alternatives here
• Clustered vs. Unclustered Indexes
• Single Key vs. Composite Indexes
• Tree-based, hash-based, other
http://ebooks.edhole.com
Alternatives for Data Entry k* in Index
• Three alternatives:
• Actual data record (with key value k)
• <k, rid of matching data record>
• <k, list of rids of matching data records>
• Choice is orthogonal to the indexing technique.
– Examples of indexing techniques: B+ trees, hash-
based structures, R trees, …
– Typically, index contains auxiliary information that
directs searches to the desired data entries
• Can have multiple (different) indexes per file.
– E.g. file sorted by age, with a hash index on salary
and a B+tree index on name.
http://ebooks.edhole.com
Alternatives for Data Entries (Contd.)
• Alternative 1:
Actual data record (with key
value k)
– If this is used, index structure is a file
organization for data records (like Heap
files or sorted files).
– At most one index on a given collection of
data records can use Alternative 1.
– This alternative saves pointer lookups but
can be expensive to maintain with
insertions and deletions.
http://ebooks.edhole.com
Alternatives for Data Entries (Contd.)
Alternative 2
<k, rid of matching data record>
and Alternative 3
<k, list of rids of matching data records>
– Easier to maintain than Alt 1.
– If more than one index is required on a given file, at most one
index can use Alternative 1; rest must use Alternatives 2 or 3.
– Alternative 3 more compact than Alternative 2, but leads to
variable sized data entries even if search keys are of fixed
length.
– Even worse, for large rid lists the data entry would have to
span multiple blocks!
http://ebooks.edhole.com
Index Classification
• Clustered vs. unclustered: If order of data
records is the same as, or `close to’, order of
index data entries, then called clustered index.
– A file can be clustered on at most one search key.
– Cost of retrieving data records through index varies
greatly based on whether index is clustered or not!
– Alternative 1 implies clustered, but not vice-versa.
http://ebooks.edhole.com
Clustered vs. Unclustered Index
• Suppose that Alternative (2) is used for data entries, and that
the data records are stored in a Heap file.
– To build clustered index, first sort the Heap file (with some free space
on each block for future inserts).
– Overflow blocks may be needed for inserts. (Thus, order of data recs
is `close to’, but not identical to, the sort order.)
Index entries
Data entries
direct search for
(Index File)
(Data file)
Data Records
data entries
Data entries
Data Records
CLUSTERED UNCLUSTERED
http://ebooks.edhole.com
Unclustered vs. Clustered Indexes
• What are the tradeoffs????
• Clustered Pros
– Efficient for range searches
– May be able to do some types of
compression
– Possible locality benefits (related data?)
– ???
• Clustered Cons
– Expensive to maintain (on the fly or sloppy
with reorganization)
http://ebooks.edhole.com
Cost of
Operations
B: The number of data pages
R: Number of records per page
D: (Average) time to read or write disk page
Heap File Sorted File Clustered File
Scan all
records
BD BD 1.5 BD
Equality
Search
0.5 BD (log2 B) * D (logF 1.5B) * D
Range
Search
BD [(log2 B) +
#match pg]*D
[(logF 1.5B) +
#match pg]*D
Insert 2D ((log2B)+B)D ((logF 1.5B)+1) *
D
Delete 0.5BD + D ((log2B)+B)D
(because R,W 0.5)
((logF 1.5B)+1) *
D
http://ebooks.edhole.com
Composite Search Keys
• Search on a combination of
fields.
– Equality query: Every field value
is equal to a constant value. E.g.
wrt <age,sal> index:
• age=20 and sal =75
– Range query: Some field value
is not a constant. E.g.:
• age > 20; or age=20 and sal >
10
• Data entries in index sorted by
search key to support range
queries.
– Lexicographic order
– Like the dictionary, but on fields,
not letters!
sue 13 75
bob
cal
joe 12
10
20
8011
12
name age sal
<sal, age>
<age, sal> <age>
<sal>
12,20
12,10
11,80
13,75
20,12
10,12
75,13
80,11
11
12
12
13
10
20
75
80
Data records
sorted by name
Data entries in index
sorted by <sal,age>
Data entries
sorted by <sal>
Examples of composite key
indexes using lexicographic order.
http://ebooks.edhole.com
Summary
• File Layer manages access to records in pages.
– Record and page formats depend on fixed vs. variable-
length.
– Free space management an important issue.
– Slotted page format supports variable length records and
allows records to move on page.
• Many alternative file organizations exist, each
appropriate in some situation.
• If selection queries are frequent, sorting the file or
building an index is important.
– Hash-based indexes only good for equality search.
– Sorted files and tree-based indexes best for range search;
also good for equality search. (Files rarely kept sorted in
practice; B+ tree index is better.)
• Index is a collection of data entries plus a way to
quickly find entries with given key values.
http://ebooks.edhole.com
Summary (Contd.)
• Data entries in index can be actual data records, <key, rid> pairs,
or <key, rid-list> pairs.
– Choice orthogonal to indexing structure (i.e., tree, hash, etc.).
• Usually have several indexes on a given file of data records, each
with a different search key.
• Indexes can be classified as clustered vs. unclustered
• Differences have important consequences for utility/performance.
• Catalog relations store information about relations, indexes and
views.
http://ebooks.edhole.com
Free Ebooks Download
Mba Ebooks
By Edhole
Mba ebooks
Free ebooks download
http://ebooks.edhole.com

Contenu connexe

En vedette

Charlottesville Lecoustre Et Al
Charlottesville Lecoustre Et AlCharlottesville Lecoustre Et Al
Charlottesville Lecoustre Et AlVivienLecoustre
 
Beneficiile pe care le aduc blogurile in lumea afacerilor
Beneficiile pe care le aduc blogurile in lumea afacerilorBeneficiile pe care le aduc blogurile in lumea afacerilor
Beneficiile pe care le aduc blogurile in lumea afacerilorcrissa79
 
Энергетика Литвы после закрытия Игналинской АЭС и перспективы строительства н...
Энергетика Литвы после закрытия Игналинской АЭС и перспективы строительства н...Энергетика Литвы после закрытия Игналинской АЭС и перспективы строительства н...
Энергетика Литвы после закрытия Игналинской АЭС и перспективы строительства н...postweb
 
2011 Marketer Meet-up St. Louis Presentation
2011 Marketer Meet-up St. Louis Presentation2011 Marketer Meet-up St. Louis Presentation
2011 Marketer Meet-up St. Louis PresentationTim McAlpine
 
Sigap bi po-ditvr brazilian interactive portable digital tv recommendation ...
Sigap   bi po-ditvr brazilian interactive portable digital tv recommendation ...Sigap   bi po-ditvr brazilian interactive portable digital tv recommendation ...
Sigap bi po-ditvr brazilian interactive portable digital tv recommendation ...Elaine Cecília Gatto
 

En vedette (11)

L0364056064
L0364056064L0364056064
L0364056064
 
Charlottesville Lecoustre Et Al
Charlottesville Lecoustre Et AlCharlottesville Lecoustre Et Al
Charlottesville Lecoustre Et Al
 
Resumen
ResumenResumen
Resumen
 
Beneficiile pe care le aduc blogurile in lumea afacerilor
Beneficiile pe care le aduc blogurile in lumea afacerilorBeneficiile pe care le aduc blogurile in lumea afacerilor
Beneficiile pe care le aduc blogurile in lumea afacerilor
 
Pelandaba clinic profile web
Pelandaba clinic profile webPelandaba clinic profile web
Pelandaba clinic profile web
 
Table for chosen song
Table for chosen songTable for chosen song
Table for chosen song
 
Энергетика Литвы после закрытия Игналинской АЭС и перспективы строительства н...
Энергетика Литвы после закрытия Игналинской АЭС и перспективы строительства н...Энергетика Литвы после закрытия Игналинской АЭС и перспективы строительства н...
Энергетика Литвы после закрытия Игналинской АЭС и перспективы строительства н...
 
Portfolio
PortfolioPortfolio
Portfolio
 
2011 Marketer Meet-up St. Louis Presentation
2011 Marketer Meet-up St. Louis Presentation2011 Marketer Meet-up St. Louis Presentation
2011 Marketer Meet-up St. Louis Presentation
 
Sigap bi po-ditvr brazilian interactive portable digital tv recommendation ...
Sigap   bi po-ditvr brazilian interactive portable digital tv recommendation ...Sigap   bi po-ditvr brazilian interactive portable digital tv recommendation ...
Sigap bi po-ditvr brazilian interactive portable digital tv recommendation ...
 
точка роста
точка ростаточка роста
точка роста
 

Plus de Edhole.com

Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarkaEdhole.com
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarkaEdhole.com
 
Website development company surat
Website development company suratWebsite development company surat
Website development company suratEdhole.com
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in suratEdhole.com
 
Website dsigning company in india
Website dsigning company in indiaWebsite dsigning company in india
Website dsigning company in indiaEdhole.com
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhiEdhole.com
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarkaEdhole.com
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarkaEdhole.com
 
Website development company surat
Website development company suratWebsite development company surat
Website development company suratEdhole.com
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in suratEdhole.com
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in indiaEdhole.com
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhiEdhole.com
 
Website designing company in mumbai
Website designing company in mumbaiWebsite designing company in mumbai
Website designing company in mumbaiEdhole.com
 
Website development company surat
Website development company suratWebsite development company surat
Website development company suratEdhole.com
 
Website desinging company in surat
Website desinging company in suratWebsite desinging company in surat
Website desinging company in suratEdhole.com
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in indiaEdhole.com
 

Plus de Edhole.com (20)

Ca in patna
Ca in patnaCa in patna
Ca in patna
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarka
 
Ca in dwarka
Ca in dwarkaCa in dwarka
Ca in dwarka
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarka
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in surat
 
Website dsigning company in india
Website dsigning company in indiaWebsite dsigning company in india
Website dsigning company in india
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhi
 
Ca in patna
Ca in patnaCa in patna
Ca in patna
 
Chartered accountant in dwarka
Chartered accountant in dwarkaChartered accountant in dwarka
Chartered accountant in dwarka
 
Ca firm in dwarka
Ca firm in dwarkaCa firm in dwarka
Ca firm in dwarka
 
Ca in dwarka
Ca in dwarkaCa in dwarka
Ca in dwarka
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website designing company in surat
Website designing company in suratWebsite designing company in surat
Website designing company in surat
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in india
 
Website designing company in delhi
Website designing company in delhiWebsite designing company in delhi
Website designing company in delhi
 
Website designing company in mumbai
Website designing company in mumbaiWebsite designing company in mumbai
Website designing company in mumbai
 
Website development company surat
Website development company suratWebsite development company surat
Website development company surat
 
Website desinging company in surat
Website desinging company in suratWebsite desinging company in surat
Website desinging company in surat
 
Website designing company in india
Website designing company in indiaWebsite designing company in india
Website designing company in india
 

Dernier

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 

Dernier (20)

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

Free Ebooks Download ! Edhole

  • 1. Free Ebooks Download Mba Ebooks By Edhole Mba ebooks Free ebooks download http://ebooks.edhole.com
  • 2. File Organizations and Indexing Lecture 4 R&G Chapter 8 "If you don't find it in the index, look very carefully through the entire catalogue." -- Sears, Roebuck, and Co., Consumer's Guide, 1897 http://ebooks.edhole.com
  • 3. Context Query Optimization and Execution Relational Operators Files and Access Methods Buffer Management Disk Space Management DB http://ebooks.edhole.com
  • 4. Alternative File Organizations Many alternatives exist, each good for some situations, and not so good in others: – Heap files: Suitable when typical access is a file scan retrieving all records. – Sorted Files: Best for retrieval in search key order, or only a `range’ of records is needed. – Clustered Files (with Indexes): Coming soon… http://ebooks.edhole.com
  • 5. Cost Model for Analysis We ignore CPU costs, for simplicity: – B: The number of data blocks – R: Number of records per block – D: (Average) time to read or write disk block – Measuring number of block I/O’s ignores gains of pre-fetching and sequential access; thus, even I/O cost is only loosely approximated. – Average-case analysis; based on several simplistic assumptions. Good enough to show the overall trends! http://ebooks.edhole.com
  • 6. Some Assumptions in the Analysis • Single record insert and delete. • Equality selection - exactly one match (what if more or less???). • Heap Files: – Insert always appends to end of file. • Sorted Files: – Files compacted after deletions. – Selections on search key. http://ebooks.edhole.com
  • 7. Cost of Operations B: The number of data pages R: Number of records per page D: (Average) time to read or write disk page Heap File Sorted File Clustered File Scan all records Equality Search Range Search Insert Delete http://ebooks.edhole.com
  • 8. Cost of Operations B: The number of data pages R: Number of records per page D: (Average) time to read or write disk page Heap File Sorted File Clustered File Scan all records BD BD Equality Search Range Search Insert Delete http://ebooks.edhole.com
  • 9. Cost of Operations B: The number of data pages R: Number of records per page D: (Average) time to read or write disk page Heap File Sorted File Clustered File Scan all records BD BD Equality Search 0.5 BD (log2 B) * D Range Search Insert Delete http://ebooks.edhole.com
  • 10. Cost of Operations B: The number of data pages R: Number of records per page D: (Average) time to read or write disk page Heap File Sorted File Clustered File Scan all records BD BD Equality Search 0.5 BD (log2 B) * D Range Search BD [(log2 B) + #match pg]*D Insert Delete http://ebooks.edhole.com
  • 11. Cost of Operations B: The number of data pages R: Number of records per page D: (Average) time to read or write disk page Heap File Sorted File Clustered File Scan all records BD BD Equality Search 0.5 BD (log2 B) * D Range Search BD [(log2 B) + #match pg]*D Insert 2D ((log2B)+B)D (because R,W 0.5) Delete http://ebooks.edhole.com
  • 12. Cost of Operations B: The number of data pages R: Number of records per page D: (Average) time to read or write disk page Heap File Sorted File Clustered File Scan all records BD BD Equality Search 0.5 BD (log2 B) * D Range Search BD [(log2 B) + #match pg]*D Insert 2D ((log2B)+B)D Delete 0.5BD + D ((log2B)+B)D (because R,W 0.5) http://ebooks.edhole.com
  • 13. Indexes • Sometimes, we want to retrieve records by specifying the values in one or more fields, e.g., – Find all students in the “CS” department – Find all students with a gpa > 3 • An index on a file is a disk-based data structure that speeds up selections on the search key fields for the index. – Any subset of the fields of a relation can be the search key for an index on the relation. – Search key is not the same as key (e.g. doesn’t have to be unique ID). • An index contains a collection of data entries, and supports efficient retrieval of all records with a given search key value k. http://ebooks.edhole.com
  • 14. First Question to Ask About Indexes • What kinds of selections do they support? – Selections of form field <op> constant – Equality selections (op is =) – Range selections (op is one of <, >, <=, >=, BETWEEN) – More exotic selections: • 2-dimensional ranges (“east of Berkeley and west of Truckee and North of Fresno and South of Eureka”) – Or n-dimensional • 2-dimensional distances (“within 2 miles of Soda Hall”) – Or n-dimensional • Ranking queries (“10 restaurants closest to Berkeley”) • Regular expression matches, genome string matches, etc. • One common n-dimensional index: R-tree – Supported in Oracle and Informix – See http://gist.cs.berkeley.edu for research on this topic http://ebooks.edhole.com
  • 15. Index Breakdown • What selections does the index support • Representation of data entries in index – i.e., what kind of info is the index actually storing? – 3 alternatives here • Clustered vs. Unclustered Indexes • Single Key vs. Composite Indexes • Tree-based, hash-based, other http://ebooks.edhole.com
  • 16. Alternatives for Data Entry k* in Index • Three alternatives: • Actual data record (with key value k) • <k, rid of matching data record> • <k, list of rids of matching data records> • Choice is orthogonal to the indexing technique. – Examples of indexing techniques: B+ trees, hash- based structures, R trees, … – Typically, index contains auxiliary information that directs searches to the desired data entries • Can have multiple (different) indexes per file. – E.g. file sorted by age, with a hash index on salary and a B+tree index on name. http://ebooks.edhole.com
  • 17. Alternatives for Data Entries (Contd.) • Alternative 1: Actual data record (with key value k) – If this is used, index structure is a file organization for data records (like Heap files or sorted files). – At most one index on a given collection of data records can use Alternative 1. – This alternative saves pointer lookups but can be expensive to maintain with insertions and deletions. http://ebooks.edhole.com
  • 18. Alternatives for Data Entries (Contd.) Alternative 2 <k, rid of matching data record> and Alternative 3 <k, list of rids of matching data records> – Easier to maintain than Alt 1. – If more than one index is required on a given file, at most one index can use Alternative 1; rest must use Alternatives 2 or 3. – Alternative 3 more compact than Alternative 2, but leads to variable sized data entries even if search keys are of fixed length. – Even worse, for large rid lists the data entry would have to span multiple blocks! http://ebooks.edhole.com
  • 19. Index Classification • Clustered vs. unclustered: If order of data records is the same as, or `close to’, order of index data entries, then called clustered index. – A file can be clustered on at most one search key. – Cost of retrieving data records through index varies greatly based on whether index is clustered or not! – Alternative 1 implies clustered, but not vice-versa. http://ebooks.edhole.com
  • 20. Clustered vs. Unclustered Index • Suppose that Alternative (2) is used for data entries, and that the data records are stored in a Heap file. – To build clustered index, first sort the Heap file (with some free space on each block for future inserts). – Overflow blocks may be needed for inserts. (Thus, order of data recs is `close to’, but not identical to, the sort order.) Index entries Data entries direct search for (Index File) (Data file) Data Records data entries Data entries Data Records CLUSTERED UNCLUSTERED http://ebooks.edhole.com
  • 21. Unclustered vs. Clustered Indexes • What are the tradeoffs???? • Clustered Pros – Efficient for range searches – May be able to do some types of compression – Possible locality benefits (related data?) – ??? • Clustered Cons – Expensive to maintain (on the fly or sloppy with reorganization) http://ebooks.edhole.com
  • 22. Cost of Operations B: The number of data pages R: Number of records per page D: (Average) time to read or write disk page Heap File Sorted File Clustered File Scan all records BD BD 1.5 BD Equality Search 0.5 BD (log2 B) * D (logF 1.5B) * D Range Search BD [(log2 B) + #match pg]*D [(logF 1.5B) + #match pg]*D Insert 2D ((log2B)+B)D ((logF 1.5B)+1) * D Delete 0.5BD + D ((log2B)+B)D (because R,W 0.5) ((logF 1.5B)+1) * D http://ebooks.edhole.com
  • 23. Composite Search Keys • Search on a combination of fields. – Equality query: Every field value is equal to a constant value. E.g. wrt <age,sal> index: • age=20 and sal =75 – Range query: Some field value is not a constant. E.g.: • age > 20; or age=20 and sal > 10 • Data entries in index sorted by search key to support range queries. – Lexicographic order – Like the dictionary, but on fields, not letters! sue 13 75 bob cal joe 12 10 20 8011 12 name age sal <sal, age> <age, sal> <age> <sal> 12,20 12,10 11,80 13,75 20,12 10,12 75,13 80,11 11 12 12 13 10 20 75 80 Data records sorted by name Data entries in index sorted by <sal,age> Data entries sorted by <sal> Examples of composite key indexes using lexicographic order. http://ebooks.edhole.com
  • 24. Summary • File Layer manages access to records in pages. – Record and page formats depend on fixed vs. variable- length. – Free space management an important issue. – Slotted page format supports variable length records and allows records to move on page. • Many alternative file organizations exist, each appropriate in some situation. • If selection queries are frequent, sorting the file or building an index is important. – Hash-based indexes only good for equality search. – Sorted files and tree-based indexes best for range search; also good for equality search. (Files rarely kept sorted in practice; B+ tree index is better.) • Index is a collection of data entries plus a way to quickly find entries with given key values. http://ebooks.edhole.com
  • 25. Summary (Contd.) • Data entries in index can be actual data records, <key, rid> pairs, or <key, rid-list> pairs. – Choice orthogonal to indexing structure (i.e., tree, hash, etc.). • Usually have several indexes on a given file of data records, each with a different search key. • Indexes can be classified as clustered vs. unclustered • Differences have important consequences for utility/performance. • Catalog relations store information about relations, indexes and views. http://ebooks.edhole.com
  • 26. Free Ebooks Download Mba Ebooks By Edhole Mba ebooks Free ebooks download http://ebooks.edhole.com