Index An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each value that appears in the indexed.

Slides:



Advertisements
Similar presentations
Tuning: overview Rewrite SQL (Leccotech)Leccotech Create Index Redefine Main memory structures (SGA in Oracle) Change the Block Size Materialized Views,
Advertisements

SQL/PL SQL Oracle By Rana Umer. Performance Tuning Indexes ROWID View Sequences Oracle By Rana Umer.
1 Lecture 8: Data structures for databases II Jose M. Peña
Physical Database Design CIT alternate keys - named constraints - indexes.
Introduction to Structured Query Language (SQL)
Quick Review of material covered Apr 8 B+-Tree Overview and some definitions –balanced tree –multi-level –reorganizes itself on insertion and deletion.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
B + -Trees (Part 1). Motivation AVL tree with N nodes is an excellent data structure for searching, indexing, etc. –The Big-Oh analysis shows most operations.
Tree-Structured Indexes. Range Searches ``Find all students with gpa > 3.0’’ –If data is in sorted file, do binary search to find first such student,
IT The Relational DBMS Section 06. Relational Database Theory Physical Database Design.
Oracle Data Block Oracle Concepts Manual. Oracle Rows Oracle Concepts Manual.
Chapter 6 Additional Database Objects
1 © Prentice Hall, 2002 Physical Database Design Dr. Bijoy Bordoloi.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 9 Index Management.
Chapter 6 1 © Prentice Hall, 2002 The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited) Project Identification and Selection Project Initiation.
School of Computing and Management Sciences © Sheffield Hallam University Finding Data –In a list of 700 composers, how do we find Berlioz? –The row with.
Chapter 6 Additional Database Objects Oracle 10g: SQL.
DBMS Implementation Chapter 6.4 V3.0 Napier University Dr Gordon Russell.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Indexes / Session 2/ 1 of 36 Session 2 Module 3: Types of Indexes Module 4: Maintaining Indexes.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
Marwan Al-Namari Hassan Al-Mathami. Indexing What is Indexing? Indexing is a mechanisms. Why we need to use Indexing? We used indexing to speed up access.
SQL/Lesson 7/Slide 1 of 32 Implementing Indexes Objectives In this lesson, you will learn to: * Create a clustered index * Create a nonclustered index.
1 Multi-Level Indexing and B-Trees. 2 Statement of the Problem When indexes grow too large they have to be stored on secondary storage. However, there.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Chapter 5 Index and Clustering
Session 1 Module 1: Introduction to Data Integrity
Chapter 4 Indexes. Indexes Logically represents subsets of data from one or more tables View Generates numeric valuesSequence Basic unit of storage; composed.
Chap 5. Disk IO Distribution Chap 6. Index Architecture Written by Yong-soon Kwon Summerized By Sungchan IDS Lab
SCALING AND PERFORMANCE CS 260 Database Systems. Overview  Increasing capacity  Database performance  Database indexes B+ Tree Index Bitmap Index 
Table Structures and Indexing. The concept of indexing If you were asked to search for the name “Adam Wilbert” in a phonebook, you would go directly to.
Query Optimization Cases. D. ChristozovINF 280 DB Systems Query Optimization: Cases 2 Executable Block 1 Algorithm using Indices (if available) Temporary.
1 Indexes ► Sort data logically to improve the speed of searching and sorting operations. ► Provide rapid retrieval of specified rows from the table without.
Select Operation Strategies And Indexing (Chapter 8)
Creating Indexes Database Systems Objectives Distinguish between the indexes that are created automatically and those that are created manually.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
Fundamentals of DBMS Notes-1.
Web Systems & Technologies
Rob Gleasure robgleasure.com
Indexes By Adrienne Watt.
Indexing Structures for Files and Physical Database Design
CS522 Advanced database Systems
Record Storage, File Organization, and Indexes
CS 540 Database Management Systems
Indexing and hashing.
SQL Implementation & Administration
Tree-Structured Indexes
Indexing ? Why ? Need to locate the actual records on disk without having to read the entire table into memory.
Indexes and Basic Access Methods
COMP 430 Intro. to Database Systems
Database Management Systems (CS 564)
Lecturer: Mukhtar Mohamed Ali “Hakaale”
Indexes … WHERE key = Table Index 22 Row pointer Key Indexes
Session #, Speaker Name Indexing Chapter 8 11/19/2018.
ORACLE I 2 Salim Phone : YM : talim_bansal.
Tree-Structured Indexes
Chapter 4 Indexes.
CH 4 Indexes.
Indexing and Hashing Basic Concepts Ordered Indices
Rob Gleasure robgleasure.com
CH 4 Indexes.
The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited)
Understanding Indexes
Database Management System
CPS216: Advanced Database Systems
Rob Gleasure robgleasure.com
Indexing, Access and Database System Architecture
Unit 12 Index in Database 大量資料存取方法之研究 Approaches to Access/Store Large Data 楊維邦 博士 國立東華大學 資訊管理系教授.
Presentation transcript:

Index An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each value that appears in the indexed columns. By default, Oracle creates B-tree indexes.

Index An index is an optional structure, associated with a table, that can sometimes speed data access. Indexes are one of many means of reducing disk I/O.

Index Indexes are schema objects that are logically and physically independent of the data in the objects with which they are associated. Thus, an index can be dropped or created without physically affecting the table for the index.

Index If you drop an index, then applications still work. However, access of previously indexed data can be slower. The absence or presence of an index does not require a change in the wording of any SQL statement. An index is a fast access path to a single row of data. It affects only the speed of execution.

Index The database automatically maintains and uses indexes after they are created. The database also automatically reflects changes to data, such as adding, updating, and deleting rows, in all relevant indexes with no additional actions required by users.

Index Retrieval performance of indexed data remains almost constant, even as rows are inserted. However, the presence of many indexes on a table degrades DML performance because the database must also update the indexes.

Create an Index CREATE INDEX index_name ON table_name (column1, column2, . column_n)

Examples CREATE INDEX supplier_idx ON supplier (supplier_name); ON supplier (supplier_name, city); ON supplier (supplier_name, city)

Create a Function-Based Index In Oracle, you are not restricted to creating indexes on only columns. You can create function-based indexes. CREATE INDEX index_name ON table_name (function1, function2, . function_n)

Create a Function-Based Index CREATE INDEX supplier_idx ON supplier (UPPER(supplier_name)); In this example, we've created an index based on the uppercase evaluation of the supplier_name field.

B-Tree Index B-trees, short for balanced trees, are the most common type of database index. A B-tree index is an ordered list of values divided into ranges. A B-tree index has two types of blocks: branch blocks for searching and leaf blocks that store values.

Image Source : Oracle Inc. A B-tree index has two types of blocks: branch blocks for searching and leaf blocks that store values.

B-Tree Index A B-tree index is balanced because all leaf blocks automatically stay at the same depth. Thus, retrieval of any record from anywhere in the index takes approximately the same amount of time. 

B-Tree Index The height of the index is the number of blocks required to go from the root block to a leaf block.  The branch level is the height minus 1. In Last Example, the index has a height of 3 and a branch level of 2.

B-Tree Index The leaf blocks contain every indexed data value and a corresponding rowid used to locate the actual row. Each entry is sorted by (key, rowid). Within a leaf block, a key and rowid is linked to its left and right sibling entries. The leaf blocks themselves are also doubly linked. In Last Example the leftmost leaf block (0-10) is linked to the second leaf block (11-19).

Bitmap Indexes Bitmap indexes use bitmaps to indicate the value of the column being indexed. This is an ideal index for a column with a low cardinality and a large table size. These indexes are not usually appropriate for tables with heavy updates. Bitmap Indexes are well suited for data warehouse applications. Source: Expert Oracle Database 11g Administration, By Sam R. A, APress

Bitmap Indexes Bitmap indexes consist of a bit stream (0 or 1) for each column in the index. Bitmap indexes are very compact compared to the normal B-tree indexes. B*Tree Bitmap Good for high-cardinality data Good for low-cardinality data Good for OLTP databases Good for data warehousing applications Use a large amount of space Use relatively little space Easy to update Difficult to update Source: Expert Oracle Database 11g Administration, By Sam R. A, APress

Bitmap Index CREATE BITMAP INDEX gender_idx ON employee(gender) Bitmap index is not a smart alternative for tables that involve large numbers of inserts, deletes, and updates.

Bitmap Index High-cardinality refers to columns with values that contains very uncommon values: Customer Name Address Email ID User Name Source: Expert Oracle Database 11g Administration, By Sam R. A, APress

Bitmap Index Low-cardinality refers to columns with few unique values. Examples are Gender Field Category IsPH IsActive Order Status

Create a Function-Based Index However, to be sure that the Oracle optimizer uses this index when executing your SQL statements, be sure that UPPER(supplier_name) does not evaluate to a NULL value. To ensure this, add UPPER(supplier_name) IS NOT NULL to your WHERE clause as follows:

Create a Function-Based Index SELECT supplier_id, supplier_name, UPPER(supplier_name) FROM supplier WHERE UPPER(supplier_name) IS NOT NULL ORDER BY UPPER(supplier_name);