SlideShare ist ein Scribd-Unternehmen logo
1 von 15
• A database index is a data structure that
improves the speed of data retrieval operations on
a database table at the cost of additional writes
and storage space to maintain the index data
structure.
• Example :
• Now, let’s say that we want to run a
query to find all the details of any
employees who are named ‘Jesus’?
So, we decide to run a simple query
like this:
• Example :
• SELECT * FROM Employee
WHERE Employee_Name = 'Jesus‘
• Well, the database software would
literally have to look at every single row
in the Customers table to see if the
customerName for that row is ‘Jesus’
• The whole point of having an index is
to speed up search queries by
essentially cutting down the number of
records/rows in a table that need to be
examined.
• B- trees are the most commonly used data
structures for indexes.
• Time efficient
• Deletions, and insertions can all be done
in logarithmic time
• No need to sort data just use algorithm to
get sorted data like inorder,postorder etc
• No need to search whole table
• Queries that compare for equality to a
string can retrieve values very fast if they
use a hash index.
• Example : SELECT * FROM Employee
WHERE Employee_Name = ‘Jesus’
• Hash tables are not sorted data structures.
• Suppose you want to find out all of the employees who
are less than 40 years old. How could you do that with a
hash table index? Well, it’s not possible because a hash
table is only good for looking up key value pairs.
• A database index does not store the
values in the other columns of the same
table.
• Example: Age and Employee_Address
column values are not also stored in the
index.
• An index stores a pointer to the table
row.
• Syntax: CREATE INDEX name_indexON
Employee (Employee_Name)
• How to create a multi-column index in SQL
• Syntax: CREATE INDEX name_indexON
Employee (Employee_Name, Employee_Age)
• ALTER TABLE tbl_name ADD PRIMARY KEY
(column_list): This statement adds a PRIMARY KEY,
which means that indexed values must be unique and
cannot be NULL
• It takes up space – and the larger your
table, the larger your index.
• Whenever you add, delete, or update rows
in the corresponding table, the same
operations will have to be done to your
index.
• Drop unused indexes
Syntax: Alter table admin drop index
searchAge
• SHOW INDEX FROM table_name
• ALTER TABLE testalter_tbl ADD PRIMARY KEY (i);
• ALTER TABLE testalter_tbl DROP PRIMARY KEY;
• CREATE TABLE lookup
(
id INT NOT NULL,
name CHAR(20),
PRIMARY KEY USING BTREE (id)
)
Cont
• CREATE TABLE lookup
(
id INT NOT NULL,
name CHAR(20),
PRIMARY KEY USING HASH (id)
)
Database indexing techniques

Weitere ähnliche Inhalte

Was ist angesagt?

Information retrieval s
Information retrieval sInformation retrieval s
Information retrieval s
silambu111
 

Was ist angesagt? (20)

Database And their types
Database And their typesDatabase And their types
Database And their types
 
Citation Database
Citation Database Citation Database
Citation Database
 
basis of infromation retrival part 1 retrival tools
basis of infromation retrival part 1 retrival toolsbasis of infromation retrival part 1 retrival tools
basis of infromation retrival part 1 retrival tools
 
citation analysis
citation analysiscitation analysis
citation analysis
 
Information retrieval s
Information retrieval sInformation retrieval s
Information retrieval s
 
Web Resources.pptx
Web Resources.pptxWeb Resources.pptx
Web Resources.pptx
 
h-index
h-indexh-index
h-index
 
Presentation on journal suggestion tool and journal finder
Presentation on journal suggestion tool and journal finderPresentation on journal suggestion tool and journal finder
Presentation on journal suggestion tool and journal finder
 
RESEARCH METRICS h-INDEX.pptx
RESEARCH METRICS h-INDEX.pptxRESEARCH METRICS h-INDEX.pptx
RESEARCH METRICS h-INDEX.pptx
 
Open access publishing
Open access publishingOpen access publishing
Open access publishing
 
Ebsco
EbscoEbsco
Ebsco
 
Research Methodology-02: Quality Indices
Research Methodology-02: Quality IndicesResearch Methodology-02: Quality Indices
Research Methodology-02: Quality Indices
 
Rdbms
RdbmsRdbms
Rdbms
 
Research Metrics
Research MetricsResearch Metrics
Research Metrics
 
Database systems
Database systemsDatabase systems
Database systems
 
Thesaurus 2101
Thesaurus 2101Thesaurus 2101
Thesaurus 2101
 
Thesaurus ppt.pptx
Thesaurus ppt.pptxThesaurus ppt.pptx
Thesaurus ppt.pptx
 
Citation analysis
Citation analysisCitation analysis
Citation analysis
 
Automatic indexing
Automatic indexingAutomatic indexing
Automatic indexing
 
Web of Science and Scopus: Understanding the indexing system
Web of Science and Scopus: Understanding the indexing systemWeb of Science and Scopus: Understanding the indexing system
Web of Science and Scopus: Understanding the indexing system
 

Andere mochten auch

12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS
koolkampus
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashing
Jeet Poria
 
Indexing and-hashing
Indexing and-hashingIndexing and-hashing
Indexing and-hashing
Ami Ranjit
 
Indexing the MySQL Index: Key to performance tuning
Indexing the MySQL Index: Key to performance tuningIndexing the MySQL Index: Key to performance tuning
Indexing the MySQL Index: Key to performance tuning
OSSCube
 

Andere mochten auch (20)

12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashing
 
Indexing Data Structure
Indexing Data StructureIndexing Data Structure
Indexing Data Structure
 
Database indexing framework
Database indexing frameworkDatabase indexing framework
Database indexing framework
 
How to Design Indexes, Really
How to Design Indexes, ReallyHow to Design Indexes, Really
How to Design Indexes, Really
 
Indexing and-hashing
Indexing and-hashingIndexing and-hashing
Indexing and-hashing
 
Introduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQLIntroduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQL
 
Image Indexing and Retrieval
Image Indexing and RetrievalImage Indexing and Retrieval
Image Indexing and Retrieval
 
1 data types
1 data types1 data types
1 data types
 
Lecture 11 Unstructured Data and the Data Warehouse
Lecture 11 Unstructured Data and the Data WarehouseLecture 11 Unstructured Data and the Data Warehouse
Lecture 11 Unstructured Data and the Data Warehouse
 
3 indexes
3 indexes3 indexes
3 indexes
 
Unstructured Data in BI
Unstructured Data in BIUnstructured Data in BI
Unstructured Data in BI
 
Indexing the MySQL Index: Key to performance tuning
Indexing the MySQL Index: Key to performance tuningIndexing the MySQL Index: Key to performance tuning
Indexing the MySQL Index: Key to performance tuning
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
 
MS SQL Server
MS SQL ServerMS SQL Server
MS SQL Server
 
Introduction to TFS 2013
Introduction to TFS 2013Introduction to TFS 2013
Introduction to TFS 2013
 
Indexers in C#
Indexers in C#Indexers in C#
Indexers in C#
 
Indexing Techniques: Their Usage in Search Engines for Information Retrieval
Indexing Techniques: Their Usage in Search Engines for Information RetrievalIndexing Techniques: Their Usage in Search Engines for Information Retrieval
Indexing Techniques: Their Usage in Search Engines for Information Retrieval
 
Using SSRS Reports with SSAS Cubes
Using SSRS Reports with SSAS CubesUsing SSRS Reports with SSAS Cubes
Using SSRS Reports with SSAS Cubes
 
Database index
Database indexDatabase index
Database index
 

Ähnlich wie Database indexing techniques

02 database oprimization - improving sql performance - ent-db
02  database oprimization - improving sql performance - ent-db02  database oprimization - improving sql performance - ent-db
02 database oprimization - improving sql performance - ent-db
uncleRhyme
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
PavithSingh
 
We Don't Need Roads: A Developers Look Into SQL Server Indexes
We Don't Need Roads: A Developers Look Into SQL Server IndexesWe Don't Need Roads: A Developers Look Into SQL Server Indexes
We Don't Need Roads: A Developers Look Into SQL Server Indexes
Richie Rump
 

Ähnlich wie Database indexing techniques (20)

SQL_Part1
SQL_Part1SQL_Part1
SQL_Part1
 
02 database oprimization - improving sql performance - ent-db
02  database oprimization - improving sql performance - ent-db02  database oprimization - improving sql performance - ent-db
02 database oprimization - improving sql performance - ent-db
 
Sql performance tuning
Sql performance tuningSql performance tuning
Sql performance tuning
 
Query Optimization in SQL Server
Query Optimization in SQL ServerQuery Optimization in SQL Server
Query Optimization in SQL Server
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
"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
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
 
Introduction of sql server indexing
Introduction of sql server indexingIntroduction of sql server indexing
Introduction of sql server indexing
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developer
 
dotnetMALAGA - Sql query tuning guidelines
dotnetMALAGA - Sql query tuning guidelinesdotnetMALAGA - Sql query tuning guidelines
dotnetMALAGA - Sql query tuning guidelines
 
Excel
ExcelExcel
Excel
 
Filtered Indexes In Sql 2008
Filtered Indexes In Sql 2008Filtered Indexes In Sql 2008
Filtered Indexes In Sql 2008
 
PostgreSQL - It's kind've a nifty database
PostgreSQL - It's kind've a nifty databasePostgreSQL - It's kind've a nifty database
PostgreSQL - It's kind've a nifty database
 
We Don't Need Roads: A Developers Look Into SQL Server Indexes
We Don't Need Roads: A Developers Look Into SQL Server IndexesWe Don't Need Roads: A Developers Look Into SQL Server Indexes
We Don't Need Roads: A Developers Look Into SQL Server Indexes
 
Sql server lesson6
Sql server lesson6Sql server lesson6
Sql server lesson6
 
Brad McGehee Intepreting Execution Plans Mar09
Brad McGehee Intepreting Execution Plans Mar09Brad McGehee Intepreting Execution Plans Mar09
Brad McGehee Intepreting Execution Plans Mar09
 
Brad McGehee Intepreting Execution Plans Mar09
Brad McGehee Intepreting Execution Plans Mar09Brad McGehee Intepreting Execution Plans Mar09
Brad McGehee Intepreting Execution Plans Mar09
 
Data Base Management System.pdf
Data Base Management System.pdfData Base Management System.pdf
Data Base Management System.pdf
 
Lecture 01 Intro to DSA
Lecture 01 Intro to DSALecture 01 Intro to DSA
Lecture 01 Intro to DSA
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 

Kürzlich hochgeladen

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
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
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 

Database indexing techniques

  • 1.
  • 2. • A database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of additional writes and storage space to maintain the index data structure. • Example :
  • 3. • Now, let’s say that we want to run a query to find all the details of any employees who are named ‘Jesus’? So, we decide to run a simple query like this: • Example : • SELECT * FROM Employee WHERE Employee_Name = 'Jesus‘
  • 4. • Well, the database software would literally have to look at every single row in the Customers table to see if the customerName for that row is ‘Jesus’
  • 5. • The whole point of having an index is to speed up search queries by essentially cutting down the number of records/rows in a table that need to be examined.
  • 6. • B- trees are the most commonly used data structures for indexes. • Time efficient • Deletions, and insertions can all be done in logarithmic time • No need to sort data just use algorithm to get sorted data like inorder,postorder etc • No need to search whole table
  • 7.
  • 8. • Queries that compare for equality to a string can retrieve values very fast if they use a hash index. • Example : SELECT * FROM Employee WHERE Employee_Name = ‘Jesus’ • Hash tables are not sorted data structures. • Suppose you want to find out all of the employees who are less than 40 years old. How could you do that with a hash table index? Well, it’s not possible because a hash table is only good for looking up key value pairs.
  • 9.
  • 10. • A database index does not store the values in the other columns of the same table. • Example: Age and Employee_Address column values are not also stored in the index. • An index stores a pointer to the table row.
  • 11. • Syntax: CREATE INDEX name_indexON Employee (Employee_Name) • How to create a multi-column index in SQL • Syntax: CREATE INDEX name_indexON Employee (Employee_Name, Employee_Age) • ALTER TABLE tbl_name ADD PRIMARY KEY (column_list): This statement adds a PRIMARY KEY, which means that indexed values must be unique and cannot be NULL
  • 12. • It takes up space – and the larger your table, the larger your index. • Whenever you add, delete, or update rows in the corresponding table, the same operations will have to be done to your index. • Drop unused indexes Syntax: Alter table admin drop index searchAge
  • 13. • SHOW INDEX FROM table_name • ALTER TABLE testalter_tbl ADD PRIMARY KEY (i); • ALTER TABLE testalter_tbl DROP PRIMARY KEY; • CREATE TABLE lookup ( id INT NOT NULL, name CHAR(20), PRIMARY KEY USING BTREE (id) )
  • 14. Cont • CREATE TABLE lookup ( id INT NOT NULL, name CHAR(20), PRIMARY KEY USING HASH (id) )