UVA CS 662 - Overview of Storage and Indexing

Unformatted text preview:

Overview of Storage and IndexingWhy Concerning Storage and Indexing?Subjects to be DiscussedStorage HierarchyWhy Not Store Everything in Main Memory?DisksComponents of a DiskAccessing a Disk PageArranging Pages on DiskSlide 10RAIDDisk Space ManagementStructure of a DBMSBuffer Management in a DBMSWhen a Page is Requested ...More on Buffer ManagementBuffer Replacement PolicyDBMS vs. OS File SystemFile OrganizationsEfficient SearchingCost Model for Our AnalysisAssumptions used for AnalysisCost of OperationsIndexIndex file and Data FileB+ Tree IndexesExample B+ TreeHash-Based IndexesStatic HashingDynamic HashingExampleInsert h(r)=20 (Causes Doubling) --- How to determine keys in A and A2?Data Entry k* in IndexAlternatives for Data Entry k* in IndexAlternatives for Data Entries (Contd.)Slide 36Index ClassificationDense vs Sparse IndexClustered IndexClustered vs. Unclustered IndexUnderstanding the WorkloadChoice of IndexesChoice of Indexes (Contd.)Index Selection GuidelinesExamples of Clustered IndexesSlide 46Slide 47Indexes with Composite Search KeysComposite Search KeysSummarySummary (Contd.)Slide 52Exercise1Overview of Storage and IndexingChapter 8“How index-learning turns no student paleYet holds the eel of science by the tail.”-- Alexander Pope (1688-1744)2Why Concerning Storage and Indexing? DB design using logical models (ER/Relational).Appropriate level for designers to begin withProvide independence from implementation detailsPerformance: another major factor in user satisfactionDepends on•Efficient data structures for data representation•Efficiency of system operation on those structuresDisks contains data files and system files including dictionary and index filesDisk access: one of the most critical factor in performance.3Subjects to be DiscussedDisks: Can retrieve random page, but reading several consecutive pages is much cheaper than reading them in random orderBuffer manager: Stages pages from external storage to main memory buffer pool. File and index layers make calls to the buffer manager.File organization: Method of arranging a file of records on external storage.Record id (rid) is sufficient to physically locate recordIndexes are data structures that allow us to find the record ids of records with given values in index search key fields4Storage Hierarchy DBMS stores information on some storage mediumPrimary storage: can be operated directly by CPU.Secondary storage: •larger capacity, lower cost, slower access•cannot be operated directly by CPU – must be copied to primary storageSecondary storage has major implications for DBMS designREAD: transfer data to main memoryWRITE: transfer data from main memory.Both transfers are high-cost operations, relative to in-memory operations, so must be planned carefully5Why Not Store Everything in Main Memory?Cost and sizeMain memory is volatile: What’s the problem?Typical storage hierarchy:Factors: access speed, cost per unit, reliabilityCache and main memory (RAM) for currently used data: fast but costlyFlash memory: limited number of writes (and slow), non-volatile, disk-substitute in embedded systemsDisk for the main database (secondary storage).Tapes for archiving older versions of the data (tertiary storage).6DisksSecondary storage device of choice. Data is stored and retrieved in units called disk blocks or pages.Unlike RAM, time to retrieve a disk page varies depending upon location on disk. Therefore, relative placement of pages on disk has major impact on DBMS performance!7Components of a Disk Platters The platters spinSpindle The arm assembly is moved in or out to position a head on a desired track. Tracks under heads make a cylinder (imaginary!).Disk headArm movementArm assembly Only one head reads/writes at any one time.TracksSector Block size is a multiple of sector size (which is fixed).8Accessing a Disk PageTime to access (read/write) a disk block:seek time (moving arms to position disk head on track)rotational delay (waiting for block to rotate under head)transfer time (actually moving data to/from disk surface)Seek time and rotational delay dominate.Seek time varies from about 1 to 20msecRotational delay varies from 0 to 10msecTransfer rate is less than 1msec per 4KB pageKey to lower I/O cost: reduce seek/rotation delays9Arranging Pages on Disk`Next’ block concept: blocks on same track, followed byblocks on same cylinder, followed byblocks on adjacent cylinderBlocks in a file should be arranged sequentially on disk (by `next’), to minimize seek and rotational delay.For a sequential scan, pre-fetching several pages at a time is a big win!10PlattersSpindleDisk headArm movementArm assemblyTracksSector11RAIDRedundant Arrays of Independent DisksDisk Array: Arrangement of several disks that gives abstraction of a single, large disk.Goals: Increase performance and reliability. Two main techniques: parallelism and redundancyData striping: Data is partitioned; size of a partition is called the striping unit. Partitions are distributed over multiple disks.Redundancy: More disks -> more failures. Redundant information allows reconstruction of data if a disk fails.RAID levels: level 0 – level 612Disk Space ManagementLowest layer of DBMS software manages space on disk.Higher levels call upon this layer to:allocate/de-allocate a pageread/write a pageHighly desirable that a request for a sequence of pages to be satisfied by allocating the pages sequentially on disk.13Structure of a DBMSA typical DBMS has a layered architecture.The figure does not show the concurrency control and recovery components.This is one of several possible architectures; each system has its own variations.Query Optimizationand ExecutionRelational OperatorsFiles and Access MethodsBuffer ManagementDisk Space ManagementDBThese layers must consider concurrencycontrol and recovery14Buffer Management in a DBMSData must be in RAM for DBMS to operate on it.Table of <frame#, pageid> pairs is maintained.DBMAIN MEMORYDISKdisk pagefree framePage Requests from Higher LevelsBUFFER POOLchoice of frame dictatedby replacement policy15When a Page is Requested ...If requested page is not in pool:Choose a frame for replacementIf frame is dirty, write it to diskRead requested page into chosen framePin the page and return its


View Full Document

UVA CS 662 - Overview of Storage and Indexing

Download Overview of Storage and Indexing
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Overview of Storage and Indexing and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Overview of Storage and Indexing 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?