Chapter 4 Indexes. Indexes Logically represents subsets of data from one or more tables View Generates numeric valuesSequence Basic unit of storage; composed.

Slides:



Advertisements
Similar presentations
9 Creating and Managing Tables. Objectives After completing this lesson, you should be able to do the following: Describe the main database objects Create.
Advertisements

Data Definition Language (DDL)
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
11-1 Copyright © Oracle Corporation, All rights reserved. Different type of keys.
10 Copyright © 2004, Oracle. All rights reserved. Creating Other Schema Objects.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
Copyright س Oracle Corporation, All rights reserved. 13 Other Database Objects.
A Guide to MySQL 7. 2 Objectives Understand, define, and drop views Recognize the benefits of using views Use a view to update data Grant and revoke users’
A Guide to SQL, Seventh Edition. Objectives Understand, create, and drop views Recognize the benefits of using views Grant and revoke user’s database.
SQL's Data Definition Language (DDL) – View, Sequence, Index.
Oracle Data Block Oracle Concepts Manual. Oracle Rows Oracle Concepts Manual.
Chapter 6 Additional Database Objects
Database Technical Session By: Prof. Adarsh Patel.
13 Other Database Objects Important Legal Notice:  Materials on this lecture are from a book titled “Oracle Education” by Kochhar, Gravina, and Nathan.
Objectives After completing this lesson, you should be able to do the following: Categorize the main database objects Review the table structure List.
Copyright © 2004, Oracle. All rights reserved. Lecture 3: Creating Other Schema Objects Lecture 3: Creating Other Schema Objects ORACLE.
12 Copyright © Oracle Corporation, All rights reserved. Other Database Objects.
11 Copyright © 2007, Oracle. All rights reserved. Creating Other Schema Objects.
Chapter 6 Additional Database Objects Oracle 10g: SQL.
Chapter 5 Sequences.
10 Copyright © 2009, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
Chapter 6 Database Administration
Lecture 2: Using DDL Statements to Create and Manage Tables & Indexes
10 Creating and Managing Tables Objectives At the end of this lesson, you will be able to: Describe the main database objects Create tables Describe.
11 Copyright © Oracle Corporation, All rights reserved. Creating Views.
Database Programming Sections 11 & 12 – Creating, and Managing Views, Sequences, Indexes, and Synonymns.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
Chapter 2 Views. Objectives ◦ Create simple and complex views ◦ Creating a view with a check constraint ◦ Retrieve data from views ◦ Data manipulation.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Chapter 9 Constraints. Chapter Objectives  Explain the purpose of constraints in a table  Distinguish among PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK,
Oracle 11g: SQL Chapter 4 Constraints.
Database Programming Sections 11 & 12 –Sequences, Indexes, and Synonymns.
© 2009 Punjab University College of Information Technology (PUCIT) September 8, 2009 Slide 1 (SQL) Other Database Objects Asif Sohail University of the.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
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.
Copyright © 2004, Oracle. All rights reserved. Lecture 2: Using DDL Statements to Create and Manage Tables & Indexes ORACLE.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
Chapter 5 Index and Clustering
Session 1 Module 1: Introduction to Data Integrity
Chapter 12 Additional Database Objects. Chapter Objectives  Define the purpose of a sequence and state how it can be used by an organization  Explain.
Altering Tables and Constraints Database Systems Objectives Add and modify columns. Add, enable, disable, or remove constraints. Drop a table. Remove.
DDL and Views. Database Objects Logically represents subsets of data from one or more tables View Generates numeric valuesSequence Basic unit of storage;
Creating Indexes on Tables An index provides quick access to data in a table, based on the values in specified columns. A table can have more than one.
Creating and Managing Tables 14. ObjectivesObjectives After completing this lesson, you should be able to do the following: After completing this lesson,
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Database Programming Sections 12 – Sequences, Indexes, and Synonymns.
Chapter 12Introduction to Oracle9i: SQL1 Chapter 12 Additional Database Objects.
Chapter Fourteen INDEX and SYNONYM Dr. Chitsaz Objectives: Create and maintain Indexes Types and applications of Indexes Create Synonym Application of.
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.
1 Database Fundamentals Introduction to SQL. 2 SQL Overview Structured Query Language The standard for relational database management systems (RDBMS)
8 Copyright © 2005, Oracle. All rights reserved. Managing Schema Objects.
SQL Basics Review Reviewing what we’ve learned so far…….
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.
TABLES AND INDEXES Ashima Wadhwa.
SQL Creating and Managing Tables
Creating Other Schema Objects
Other Database Objects
SQL Creating and Managing Tables
Creating Other Schema Objects
SQL Creating and Managing Tables
Chapter 5 Sequences.
Chapter 4 Indexes.
CH 4 Indexes.
Chapter 2 Views.
A Guide to SQL, Eighth Edition
CH 4 Indexes.
Chapter 2 Views.
IST 318 Database Administration
Other Database Objects
Presentation transcript:

Chapter 4 Indexes

Indexes Logically represents subsets of data from one or more tables View Generates numeric valuesSequence Basic unit of storage; composed of rowsTable Gives alternative names to objectsSynonym Improves the performance of some queriesIndex DescriptionObject

Indexes An index: Is a schema object Can be used by the Oracle server to speed up the retrieval of rows by using a pointer If you do not have an index on the column, then a full table scan occurs. Can reduce disk input/output (I/O) by using a rapid path access method to locate data quickly Is independent of the table that it indexes This means that they can be created or dropped at any time, and have no effect on the base tables or other indexes. Is used and maintained automatically by the Oracle server When you drop a table, the corresponding indexes are also dropped.

How Are Indexes Created? Automatically: A unique index is created automatically when you define a PRIMARY KEY or UNIQUE constraint in a table definition. Manually: Users can create nonunique indexes on columns to speed up access to the rows. You can manually create a unique index, but it is recommended that you create a unique constraint, which implicitly creates a unique index.

Creating an Index Create an index on one or more columns: Specify UNIQUE to indicate that the value of the column (or columns) upon which the index is based must be unique. Alternatively, you can define UNIQUE integrity constraints on the desired columns Improve the speed of query access to the LAST_NAME column in the EMPLOYEES table: CREATE INDEX emp_last_name_idx ON employees(last_name); CREATE [UNIQUE] INDEX indexName ON table (column[, column]...);

Index Creation Guidelines Do not create an index when: The columns are not often used as a condition in the query The table is small or most queries are expected to retrieve more than 2% to 4% of the rows in the table The table is updated frequently A column contains a large number of null values One or more columns are frequently used together in a WHERE clause or a join condition A column contains a wide range of values The indexed columns are referenced as part of an expression The table is large and most queries are expected to retrieve less than 2% to 4% of the rows in the table Create an index when:

More Is Not Always Better Having more indexes on a table does not produce faster queries. Each DML operation that is committed on a table with indexes means that the indexes must be updated. The more indexes that you have associated with a table, the more effort the Oracle server must make to update all the indexes after a DML operation.

Removing an Index Remove an index from the data dictionary by using the DROP INDEX command: Remove the emp_last_name_idx index To drop an index, you must be the owner of the index or have the DROP ANY INDEX privilege. You cannot modify indexes. To change an index, you must drop it and then re-create it. DROP INDEX emp_last_name_idx; DROP INDEX indexName;