SlideShare a Scribd company logo
INDEXING Davood Pour Yousefian Barfeh
INDEXING ,[object Object],[object Object],[object Object],[object Object]
What is index? ,[object Object],[object Object],[object Object]
Why is Index needed? (((((Advantage))))) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Indexing (((((Disadvantage))))) ,[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Ex. Without Indexing
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Ex.Using Indexing
When  should  indexing be used?   can ,[object Object],[object Object],[object Object],[object Object]
When should indexing be used? ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],When should indexing be used?
When should indexing be used? ,[object Object],[object Object],[object Object],[object Object],[object Object],Index Selectivity = Number of distinct values Number of records
When should indexing be used? ,[object Object],[object Object],SELECT newstitle, firstname, lastname  FROM newsitem n, authors a  WHERE n.authorid=a.authorid; CREATE INDEX newsitem_authorid  ON newsitem(authorid); General Rule: Any fields involved in a table join must be indexed  CREATE TABLE newsitem (   newsid INT PRIMARY KEY,   newstitle VARCHAR(255),   newscontent TEXT,   authorid INT,   newsdate TIMESTAMP ); CREATE TABLE authors (   authorid INT PRIMARY KEY,   username VARCHAR(255),   firstname VARCHAR(255),   lastname VARCHAR(255) );
When should indexing be used? SELECT n.newstitle, c.categoryname  FROM categories c, newsitem_categories nc, newsitem n  WHERE c.categoryid=nc.categoryid AND nc.newsid=n.newsid; These fields must be indexed: newsitem   newsid newsitem_categories   newsid newsitem_categories   categoryid categories   categoryid CREATE INDEX newscat_news  ON newsitem_categories(newsid); CREATE INDEX newscat_cats  ON newsitem_categories(categoryid); Ex. CREATE TABLE newsitem (   newsid INT PRIMARY KEY,   newstitle VARCHAR(255),   newscontent TEXT,   authorid INT,   newsdate TIMESTAMP ); CREATE TABLE newsitem_categories (   newsid INT,   categoryid INT ); CREATE TABLE categories (   categoryid INT PRIMARY KEY,    categoryname VARCHAR(255) );
Combination on Indexing CREATE INDEX newscat_news ON newsitem_categories(newsid); CREATE INDEX newscat_cats ON newsitem_categories(categoryid); CREATE INDEX news_cats ON newsitem_categories(newsid, categoryid); Can we do? YES but LIMITATIONs
Conjunctions in Cobnations on Indexing CREATE TABLE example (   a int,   b int,   c int ); CREATE INDEX example_index  ON example(a,b,c);   ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Types of indexes (1) ,[object Object],[object Object],indexes whose order of the rows in the data page correspond to the order of the rows in the index  ,[object Object],[object Object],[object Object],[object Object],[object Object],Order of rows is not important
Types of indexes (2) ,[object Object],[object Object],help maintain data integrity by ensuring  that no two rows of data in a table  have identical key values uniqueness is enforced   improve query performance  by maintaining a sorted order of data values  that are used frequently
Types of indexes (3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Types of indexes (4) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Syntax of Index (1) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Access Method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Syntax of Index(2) ,[object Object],[object Object],[object Object],[object Object]
Summary  ,[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Classified and coordinate indexes clydee
Classified and coordinate indexes clydeeClassified and coordinate indexes clydee
Classified and coordinate indexes clydee
jeancly
 
Library classification systems.ppt 2011
Library classification systems.ppt 2011Library classification systems.ppt 2011
Library classification systems.ppt 2011
lokaraja
 
Controlled Vocabulary
Controlled VocabularyControlled Vocabulary
Controlled Vocabulary
guest118a9a
 
Chain indexing
Chain indexingChain indexing
Chain indexing
silambu111
 
Normative principles of cataloguing
Normative principles of cataloguingNormative principles of cataloguing
Normative principles of cataloguing
Sarika Sawant
 

What's hot (20)

Uniterm indexing
Uniterm indexing Uniterm indexing
Uniterm indexing
 
Classified Catalogue Code (ccc)
Classified Catalogue Code (ccc)Classified Catalogue Code (ccc)
Classified Catalogue Code (ccc)
 
A comparative analysis of library classification systems
A comparative analysis of library classification systemsA comparative analysis of library classification systems
A comparative analysis of library classification systems
 
Subject Heading Lists: SLSH VS LCSH
Subject Heading Lists: SLSH VS LCSHSubject Heading Lists: SLSH VS LCSH
Subject Heading Lists: SLSH VS LCSH
 
Library Classification
Library ClassificationLibrary Classification
Library Classification
 
Abstract and i ndexing
Abstract and i ndexingAbstract and i ndexing
Abstract and i ndexing
 
Classified and coordinate indexes clydee
Classified and coordinate indexes clydeeClassified and coordinate indexes clydee
Classified and coordinate indexes clydee
 
MARC -21.pptx
MARC -21.pptxMARC -21.pptx
MARC -21.pptx
 
Library Classification ppt Arun Joseph MPhil
Library Classification ppt Arun Joseph MPhilLibrary Classification ppt Arun Joseph MPhil
Library Classification ppt Arun Joseph MPhil
 
Library classification systems.ppt 2011
Library classification systems.ppt 2011Library classification systems.ppt 2011
Library classification systems.ppt 2011
 
Canons of cataloguing
Canons of cataloguingCanons of cataloguing
Canons of cataloguing
 
Subject Indexing & Techniques
Subject Indexing  & TechniquesSubject Indexing  & Techniques
Subject Indexing & Techniques
 
Index and abstract (3)
Index and abstract (3)Index and abstract (3)
Index and abstract (3)
 
Bibliographic description an overview
Bibliographic description an overviewBibliographic description an overview
Bibliographic description an overview
 
POPSI
POPSIPOPSI
POPSI
 
Controlled Vocabulary
Controlled VocabularyControlled Vocabulary
Controlled Vocabulary
 
Chain indexing
Chain indexingChain indexing
Chain indexing
 
Bibliography: definitions and types
Bibliography: definitions and typesBibliography: definitions and types
Bibliography: definitions and types
 
Library of Congress Classification
Library of Congress ClassificationLibrary of Congress Classification
Library of Congress Classification
 
Normative principles of cataloguing
Normative principles of cataloguingNormative principles of cataloguing
Normative principles of cataloguing
 

Similar to Indexing

Physical elements of data
Physical elements of dataPhysical elements of data
Physical elements of data
Dimara Hakim
 
Intro to tsql unit 7
Intro to tsql   unit 7Intro to tsql   unit 7
Intro to tsql unit 7
Syed Asrarali
 

Similar to Indexing (20)

Indexing
IndexingIndexing
Indexing
 
Indexing techniques
Indexing techniquesIndexing techniques
Indexing techniques
 
Physical Design and Development
Physical Design and DevelopmentPhysical Design and Development
Physical Design and Development
 
Unit08 dbms
Unit08 dbmsUnit08 dbms
Unit08 dbms
 
Cs341
Cs341Cs341
Cs341
 
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1 "Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
 
MySQL Indexes
MySQL IndexesMySQL Indexes
MySQL Indexes
 
Indexing Strategies
Indexing StrategiesIndexing Strategies
Indexing Strategies
 
Physical elements of data
Physical elements of dataPhysical elements of data
Physical elements of data
 
Database Sizing
Database SizingDatabase Sizing
Database Sizing
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
 
Tunning sql query
Tunning sql queryTunning sql query
Tunning sql query
 
Mysql Optimization
Mysql OptimizationMysql Optimization
Mysql Optimization
 
MySQL Indexing
MySQL IndexingMySQL Indexing
MySQL Indexing
 
Intro to tsql unit 7
Intro to tsql   unit 7Intro to tsql   unit 7
Intro to tsql unit 7
 
unit 1 ppt.pptx
unit 1 ppt.pptxunit 1 ppt.pptx
unit 1 ppt.pptx
 
Sql server lesson6
Sql server lesson6Sql server lesson6
Sql server lesson6
 
Module 3
Module 3Module 3
Module 3
 
Cs437 lecture 16-18
Cs437 lecture 16-18Cs437 lecture 16-18
Cs437 lecture 16-18
 
Database Performance
Database PerformanceDatabase Performance
Database Performance
 

Recently uploaded

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdf
YibeltalNibretu
 

Recently uploaded (20)

Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Accounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdfAccounting and finance exit exam 2016 E.C.pdf
Accounting and finance exit exam 2016 E.C.pdf
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 

Indexing

  • 1. INDEXING Davood Pour Yousefian Barfeh
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. When should indexing be used? SELECT n.newstitle, c.categoryname FROM categories c, newsitem_categories nc, newsitem n WHERE c.categoryid=nc.categoryid AND nc.newsid=n.newsid; These fields must be indexed: newsitem  newsid newsitem_categories  newsid newsitem_categories  categoryid categories  categoryid CREATE INDEX newscat_news ON newsitem_categories(newsid); CREATE INDEX newscat_cats ON newsitem_categories(categoryid); Ex. CREATE TABLE newsitem (   newsid INT PRIMARY KEY,   newstitle VARCHAR(255),   newscontent TEXT,   authorid INT,   newsdate TIMESTAMP ); CREATE TABLE newsitem_categories (   newsid INT,   categoryid INT ); CREATE TABLE categories (   categoryid INT PRIMARY KEY,   categoryname VARCHAR(255) );
  • 14. Combination on Indexing CREATE INDEX newscat_news ON newsitem_categories(newsid); CREATE INDEX newscat_cats ON newsitem_categories(categoryid); CREATE INDEX news_cats ON newsitem_categories(newsid, categoryid); Can we do? YES but LIMITATIONs
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.