SlideShare a Scribd company logo
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Five Tips to Get the
Most out of Your Indexes
1
Maria Colgan
Master Product Manager
Oracle Database Server Technologies
June 2018
JEFF
@SQLMaria
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
B-Tree Indexes
– Available since 5, they are the
most common type of index
– Goal: minimize time to find
small amounts of data
– Including function-based,
Reverse Key Indexes, & IOTs
– One to one mapping, little
degradation in retrieval
performance as underlying
table grows
Bitmap Indexes
– Available since 7.3, designed
for read-mostly workloads
– Goal: Improve performance
of ad-hoc analytic queries
– A single bitmap key entry
points to many rows
– Multiple indexes can be used
together to determine rowids
– Bitmap Join indexes replaces
need for two table join
2
Text Search Indexes
– Available since 8i designed for
text retrieval
– Goal: Quickly identify large
coherent documents
– Can index documents of
different formats such as MS
Word, HTML or plain text
– A single entry points to many
documents
Oracle Offers a Variety of Different Indexing Techniques
Root Block
leaf Blocks
Branch Blocks
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Reverse Key Indexes
• Reverse key indexes physically stores the bytes of the keys in reverse order
– CREATE INDEX sales_prod_reverse_idx ON sales(prod_id) REVERSE;
• Used to avoid “hot block syndrome” or buffer busy waits
– On columns with monotonically increasing values
– Eg: sequence populated fields or dates/timestamps
• At a cost
– Prevents some index range scans as 5 is not stored next to 6
• Equality predicates on non-unique index will use index range scan
• Range predicates such as between, <, > etc. may not use index
– Additional CPU evident mostly in single user mode, with multi-users you see less
overall CPU because you are not spinning on a buffer wait
Relieving Index contention
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Partially Useable Indexes
• Enables the creation of local or global indexes on just a subset of partitions
• Indexing only the stable partitions (little or no DML) minimizes the impact
on ingest performance
• Queries accessing data only within the indexed partitions will use the index
• Queries that access data only in the non-indexed partitions will do full scan
• Queries accessing partitions with and without indexes can take advantage
of the query transformation called Table Expansion
• Supported by definition on Partition views
4
Relieving Index contention
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Partially Useable Indexes
CREATE TABLE sales(order_status char(6) not null, order_date…)
INDEXING ON
PARTITION BY LIST (order_status)(
PARTITION p1 VALUES(‘OPEN’) INDEXING OFF,
PARTITION p2 VALUES(‘CLOSED’));
5
Relieving Index contention
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Table Expansion Transformation
6
P1: ORDER_STATUS=‘OPEN’
SELECT * FROM sales
WHERE ORDER_DATE between‘2017-01-01’ and ‘2017-12-31’;
P2: ORDER_STATUS=‘CLOSED’
P1: Best access path is full table scan
SALES
P2: Best access path is index scan
Local index on
ORDER_DATE
IDX_SALES: ORDER_DATE
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Table Expansion Transformation
----------------------------------------------------------------------
| Id | Operation | Name | Pstart| Pstop |
----------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | |
| 1 | SORT AGGREGATE | | | |
| 2 | VIEW | VW_TE_2 | | |
| 3 | UNION-ALL | | | |
| 4 | PARTITION RANGE SINGLE | | 1 | 1 |
|* 5 | TABLE ACCESS FULL | SALES | 1 | 1 |
| 6 | PARTITION RANGE SINGLE | | 2 | 2 |
|* 7 | INDEX RANGE SCAN | IDX_SALES | 2 | 2 |
----------------------------------------------------------------------
5 - access("ORDER_DATE“>=TO_DATE(' 2017-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
"ORDER_DATE"<=TO_DATE(' 2018-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
filter("ORDER_DATE“>=TO_DATE(' 2017-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
"ORDER_DATE"<=TO_DATE(' 2018-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
7 - access("ORDER_DATE“>=TO_DATE(' 2017-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
"ORDER_DATE"<=TO_DATE(' 2018-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Indexing Nulls
• Bitmap indexes – always index nulls
• B*Tree cluster indexes – always index nulls
• B*Tree indexes do not if and only if the entire key is null (all columns)
8
CREATE INDEX i ON t(object_id,0);
SELECT * FROM t WHERE object_id is NULL;
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1445 | 149K| 96 (0)| 00:00:02 |
| 1 | TABLE ACCESS BY INDEX ROWID| T | 1445 | 149K| 96 (0)| 00:00:02 |
|* 2 | INDEX RANGE SCAN | I | 1445 | | 7 (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 9
• How do I know which indexes are actually
needed?
• New DBA_INDEX_USAGE views provide usage
histograms and access details for all indexes
• Track index usage with no overhead
Index Usage Statistics
Public
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Index Usage Statistics
10Public
Index entries with no statistics
indicate indexes that currently are
not being used
These are potential candidates to
be deleted
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
INVISIBLE Indexes
• Ability to create and maintains an index that the optimizer is blind to
– Optimizer can’t use an invisible index as an access method
• Easy mechanism to begin the process of removing unused indexes
1. Mark the index invisible
ALTER INDEX i INVISIBLE;
2. If no one misses it for a complete business cycle, its safe to drop it
• Also useful to test out the benefit of a new index before publishing it
1. Create invisible index
CREATE INDEX i ON t(x, object_id) INVISIBLE;
2. Set parameter OPTIMIZER_USE_INVISIBLE_INDEXES to true in 1 session to test
ALTER SESSION SET optimizer_use_invisible_indexes=true;
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Indexes are a critical tool to help improve performance
12
Indexes
ORACLE
Use them wisely to
greatly improve speed of
data access …..
…Over use them and you
will grind the system to a
halt!

More Related Content

What's hot

The Changing Role of a DBA in an Autonomous World
The Changing Role of a DBA in an Autonomous WorldThe Changing Role of a DBA in an Autonomous World
The Changing Role of a DBA in an Autonomous World
Maria Colgan
 
One Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic IndexingOne Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic Indexing
Jim Czuprynski
 
Sql parametrized queries
Sql parametrized queriesSql parametrized queries
Sql parametrized queries
Hadi Fadlallah
 
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
Oracle SQL Tuning for Day-to-Day Data Warehouse SupportOracle SQL Tuning for Day-to-Day Data Warehouse Support
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
nkarag
 
Gl wand-5.5-brochure-2014
Gl wand-5.5-brochure-2014Gl wand-5.5-brochure-2014
Gl wand-5.5-brochure-2014
Jarod Ouye
 
Aggreagate awareness
Aggreagate awarenessAggreagate awareness
Aggreagate awareness
Yogeeswar Reddy
 
Creating Views - oracle database
Creating Views - oracle databaseCreating Views - oracle database
Creating Views - oracle database
Salman Memon
 
Implementing views
Implementing views Implementing views
Implementing views
sqlschoolgr
 
SQLDay2013_MarcinSzeliga_StoredProcedures
SQLDay2013_MarcinSzeliga_StoredProceduresSQLDay2013_MarcinSzeliga_StoredProcedures
SQLDay2013_MarcinSzeliga_StoredProcedures
Polish SQL Server User Group
 
Database performance tuning and query optimization
Database performance tuning and query optimizationDatabase performance tuning and query optimization
Database performance tuning and query optimization
Usman Tariq
 
CAR EVALUATION DATABASE
CAR EVALUATION DATABASECAR EVALUATION DATABASE
CAR EVALUATION DATABASE
Venkatesh Ramshetty Venkataramana
 
Remus_3_0
Remus_3_0Remus_3_0
Remus_3_0
Prashasth Patil
 
The Plan Cache Whisperer - Performance Tuning SQL Server
The Plan Cache Whisperer - Performance Tuning SQL ServerThe Plan Cache Whisperer - Performance Tuning SQL Server
The Plan Cache Whisperer - Performance Tuning SQL Server
Jason Strate
 
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
Trivadis
 
Calnf
CalnfCalnf
Oracle advanced supply chain planning implementation and user
Oracle advanced supply chain planning implementation and userOracle advanced supply chain planning implementation and user
Oracle advanced supply chain planning implementation and user
Sairam Laga
 
Oracle Database 12c features for DBA
Oracle Database 12c features for DBAOracle Database 12c features for DBA
Oracle Database 12c features for DBA
Karan Kukreja
 
The Database Environment Chapter 7
The Database Environment Chapter 7The Database Environment Chapter 7
The Database Environment Chapter 7
Jeanie Arnoco
 
Chapter 08 abap dictionary objects views1
Chapter 08 abap dictionary objects views1Chapter 08 abap dictionary objects views1
Chapter 08 abap dictionary objects views1
Kranthi Kumar
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query Performance
Karen Morton
 

What's hot (20)

The Changing Role of a DBA in an Autonomous World
The Changing Role of a DBA in an Autonomous WorldThe Changing Role of a DBA in an Autonomous World
The Changing Role of a DBA in an Autonomous World
 
One Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic IndexingOne Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic Indexing
 
Sql parametrized queries
Sql parametrized queriesSql parametrized queries
Sql parametrized queries
 
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
Oracle SQL Tuning for Day-to-Day Data Warehouse SupportOracle SQL Tuning for Day-to-Day Data Warehouse Support
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
 
Gl wand-5.5-brochure-2014
Gl wand-5.5-brochure-2014Gl wand-5.5-brochure-2014
Gl wand-5.5-brochure-2014
 
Aggreagate awareness
Aggreagate awarenessAggreagate awareness
Aggreagate awareness
 
Creating Views - oracle database
Creating Views - oracle databaseCreating Views - oracle database
Creating Views - oracle database
 
Implementing views
Implementing views Implementing views
Implementing views
 
SQLDay2013_MarcinSzeliga_StoredProcedures
SQLDay2013_MarcinSzeliga_StoredProceduresSQLDay2013_MarcinSzeliga_StoredProcedures
SQLDay2013_MarcinSzeliga_StoredProcedures
 
Database performance tuning and query optimization
Database performance tuning and query optimizationDatabase performance tuning and query optimization
Database performance tuning and query optimization
 
CAR EVALUATION DATABASE
CAR EVALUATION DATABASECAR EVALUATION DATABASE
CAR EVALUATION DATABASE
 
Remus_3_0
Remus_3_0Remus_3_0
Remus_3_0
 
The Plan Cache Whisperer - Performance Tuning SQL Server
The Plan Cache Whisperer - Performance Tuning SQL ServerThe Plan Cache Whisperer - Performance Tuning SQL Server
The Plan Cache Whisperer - Performance Tuning SQL Server
 
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
Trivadis TechEvent 2016 What's new in SQL Server 2016 in Analysis Services by...
 
Calnf
CalnfCalnf
Calnf
 
Oracle advanced supply chain planning implementation and user
Oracle advanced supply chain planning implementation and userOracle advanced supply chain planning implementation and user
Oracle advanced supply chain planning implementation and user
 
Oracle Database 12c features for DBA
Oracle Database 12c features for DBAOracle Database 12c features for DBA
Oracle Database 12c features for DBA
 
The Database Environment Chapter 7
The Database Environment Chapter 7The Database Environment Chapter 7
The Database Environment Chapter 7
 
Chapter 08 abap dictionary objects views1
Chapter 08 abap dictionary objects views1Chapter 08 abap dictionary objects views1
Chapter 08 abap dictionary objects views1
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query Performance
 

Similar to Five Tips to Get the Most Out of Your Indexing

MySQL partitioning
MySQL partitioning MySQL partitioning
MySQL partitioning
OracleMySQL
 
Introducing Postgres Plus Advanced Server 9.4
Introducing Postgres Plus Advanced Server 9.4 Introducing Postgres Plus Advanced Server 9.4
Introducing Postgres Plus Advanced Server 9.4
EDB
 
Optimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxOptimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptx
JasonTuran2
 
How to analyze and tune sql queries for better performance
How to analyze and tune sql queries for better performanceHow to analyze and tune sql queries for better performance
How to analyze and tune sql queries for better performance
oysteing
 
Introducing Postgres Plus Advanced Server 9.4
Introducing Postgres Plus Advanced Server 9.4Introducing Postgres Plus Advanced Server 9.4
Introducing Postgres Plus Advanced Server 9.4
EDB
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices I
Carlos Oliveira
 
How to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better PerformanceHow to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better Performance
oysteing
 
What's New MySQL 8.0?
What's New MySQL 8.0?What's New MySQL 8.0?
What's New MySQL 8.0?
OracleMySQL
 
Tips tricks to speed nw bi 2009
Tips tricks to speed  nw bi  2009Tips tricks to speed  nw bi  2009
Tips tricks to speed nw bi 2009
HawaDia
 
Overview of EnterpriseDB Postgres Plus Advanced Server 9.4 and Postgres Enter...
Overview of EnterpriseDB Postgres Plus Advanced Server 9.4 and Postgres Enter...Overview of EnterpriseDB Postgres Plus Advanced Server 9.4 and Postgres Enter...
Overview of EnterpriseDB Postgres Plus Advanced Server 9.4 and Postgres Enter...
EDB
 
FDMEE Can Do That?
FDMEE Can Do That?FDMEE Can Do That?
FDMEE Can Do That?
Alithya
 
Big SQL 3.0 - Fast and easy SQL on Hadoop
Big SQL 3.0 - Fast and easy SQL on HadoopBig SQL 3.0 - Fast and easy SQL on Hadoop
Big SQL 3.0 - Fast and easy SQL on Hadoop
Wilfried Hoge
 
IRJET- A Comprehensive Review on Query Optimization for Distributed Databases
IRJET- A Comprehensive Review on Query Optimization for Distributed DatabasesIRJET- A Comprehensive Review on Query Optimization for Distributed Databases
IRJET- A Comprehensive Review on Query Optimization for Distributed Databases
IRJET Journal
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
Dave Stokes
 
IRJET- Analysis for EnhancedForecastof Expense Movement in Stock Exchange
IRJET- Analysis for EnhancedForecastof Expense Movement in Stock ExchangeIRJET- Analysis for EnhancedForecastof Expense Movement in Stock Exchange
IRJET- Analysis for EnhancedForecastof Expense Movement in Stock Exchange
IRJET Journal
 
Utilizing BI 11g Reporting To Get The Most Out of P6
Utilizing BI 11g Reporting To Get The Most Out of P6Utilizing BI 11g Reporting To Get The Most Out of P6
Utilizing BI 11g Reporting To Get The Most Out of P6
p6academy
 
Vision Reporting - Configuration Tips
Vision Reporting - Configuration TipsVision Reporting - Configuration Tips
Vision Reporting - Configuration Tips
Sysco Software
 
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
Dave Stokes
 
Indexes overview
Indexes overviewIndexes overview
Indexes overview
aioughydchapter
 
Sitecore user group mumbai sitecore commerce extension
Sitecore user group mumbai  sitecore commerce extensionSitecore user group mumbai  sitecore commerce extension
Sitecore user group mumbai sitecore commerce extension
Jitendra Soni
 

Similar to Five Tips to Get the Most Out of Your Indexing (20)

MySQL partitioning
MySQL partitioning MySQL partitioning
MySQL partitioning
 
Introducing Postgres Plus Advanced Server 9.4
Introducing Postgres Plus Advanced Server 9.4 Introducing Postgres Plus Advanced Server 9.4
Introducing Postgres Plus Advanced Server 9.4
 
Optimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxOptimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptx
 
How to analyze and tune sql queries for better performance
How to analyze and tune sql queries for better performanceHow to analyze and tune sql queries for better performance
How to analyze and tune sql queries for better performance
 
Introducing Postgres Plus Advanced Server 9.4
Introducing Postgres Plus Advanced Server 9.4Introducing Postgres Plus Advanced Server 9.4
Introducing Postgres Plus Advanced Server 9.4
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices I
 
How to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better PerformanceHow to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better Performance
 
What's New MySQL 8.0?
What's New MySQL 8.0?What's New MySQL 8.0?
What's New MySQL 8.0?
 
Tips tricks to speed nw bi 2009
Tips tricks to speed  nw bi  2009Tips tricks to speed  nw bi  2009
Tips tricks to speed nw bi 2009
 
Overview of EnterpriseDB Postgres Plus Advanced Server 9.4 and Postgres Enter...
Overview of EnterpriseDB Postgres Plus Advanced Server 9.4 and Postgres Enter...Overview of EnterpriseDB Postgres Plus Advanced Server 9.4 and Postgres Enter...
Overview of EnterpriseDB Postgres Plus Advanced Server 9.4 and Postgres Enter...
 
FDMEE Can Do That?
FDMEE Can Do That?FDMEE Can Do That?
FDMEE Can Do That?
 
Big SQL 3.0 - Fast and easy SQL on Hadoop
Big SQL 3.0 - Fast and easy SQL on HadoopBig SQL 3.0 - Fast and easy SQL on Hadoop
Big SQL 3.0 - Fast and easy SQL on Hadoop
 
IRJET- A Comprehensive Review on Query Optimization for Distributed Databases
IRJET- A Comprehensive Review on Query Optimization for Distributed DatabasesIRJET- A Comprehensive Review on Query Optimization for Distributed Databases
IRJET- A Comprehensive Review on Query Optimization for Distributed Databases
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
 
IRJET- Analysis for EnhancedForecastof Expense Movement in Stock Exchange
IRJET- Analysis for EnhancedForecastof Expense Movement in Stock ExchangeIRJET- Analysis for EnhancedForecastof Expense Movement in Stock Exchange
IRJET- Analysis for EnhancedForecastof Expense Movement in Stock Exchange
 
Utilizing BI 11g Reporting To Get The Most Out of P6
Utilizing BI 11g Reporting To Get The Most Out of P6Utilizing BI 11g Reporting To Get The Most Out of P6
Utilizing BI 11g Reporting To Get The Most Out of P6
 
Vision Reporting - Configuration Tips
Vision Reporting - Configuration TipsVision Reporting - Configuration Tips
Vision Reporting - Configuration Tips
 
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
 
Indexes overview
Indexes overviewIndexes overview
Indexes overview
 
Sitecore user group mumbai sitecore commerce extension
Sitecore user group mumbai  sitecore commerce extensionSitecore user group mumbai  sitecore commerce extension
Sitecore user group mumbai sitecore commerce extension
 

More from Maria Colgan

Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptxFive_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
Maria Colgan
 
Part4 Influencing Execution Plans with Optimizer Hints
Part4 Influencing Execution Plans with Optimizer HintsPart4 Influencing Execution Plans with Optimizer Hints
Part4 Influencing Execution Plans with Optimizer Hints
Maria Colgan
 
Ground Breakers Romania: Oracle Autonomous Database
Ground Breakers Romania: Oracle Autonomous DatabaseGround Breakers Romania: Oracle Autonomous Database
Ground Breakers Romania: Oracle Autonomous Database
Maria Colgan
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19c
Maria Colgan
 
Oracle Database in-Memory Overivew
Oracle Database in-Memory OverivewOracle Database in-Memory Overivew
Oracle Database in-Memory Overivew
Maria Colgan
 
JSON and the Oracle Database
JSON and the Oracle DatabaseJSON and the Oracle Database
JSON and the Oracle Database
Maria Colgan
 
Harnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer HintsHarnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer Hints
Maria Colgan
 
Oracle optimizer bootcamp
Oracle optimizer bootcampOracle optimizer bootcamp
Oracle optimizer bootcamp
Maria Colgan
 
What_to_expect_from_oracle_database_12c
What_to_expect_from_oracle_database_12cWhat_to_expect_from_oracle_database_12c
What_to_expect_from_oracle_database_12c
Maria Colgan
 
Oracle database 12c_and_DevOps
Oracle database 12c_and_DevOpsOracle database 12c_and_DevOps
Oracle database 12c_and_DevOps
Maria Colgan
 

More from Maria Colgan (10)

Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptxFive_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
 
Part4 Influencing Execution Plans with Optimizer Hints
Part4 Influencing Execution Plans with Optimizer HintsPart4 Influencing Execution Plans with Optimizer Hints
Part4 Influencing Execution Plans with Optimizer Hints
 
Ground Breakers Romania: Oracle Autonomous Database
Ground Breakers Romania: Oracle Autonomous DatabaseGround Breakers Romania: Oracle Autonomous Database
Ground Breakers Romania: Oracle Autonomous Database
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19c
 
Oracle Database in-Memory Overivew
Oracle Database in-Memory OverivewOracle Database in-Memory Overivew
Oracle Database in-Memory Overivew
 
JSON and the Oracle Database
JSON and the Oracle DatabaseJSON and the Oracle Database
JSON and the Oracle Database
 
Harnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer HintsHarnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer Hints
 
Oracle optimizer bootcamp
Oracle optimizer bootcampOracle optimizer bootcamp
Oracle optimizer bootcamp
 
What_to_expect_from_oracle_database_12c
What_to_expect_from_oracle_database_12cWhat_to_expect_from_oracle_database_12c
What_to_expect_from_oracle_database_12c
 
Oracle database 12c_and_DevOps
Oracle database 12c_and_DevOpsOracle database 12c_and_DevOps
Oracle database 12c_and_DevOps
 

Recently uploaded

Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 

Recently uploaded (20)

Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 

Five Tips to Get the Most Out of Your Indexing

  • 1. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Five Tips to Get the Most out of Your Indexes 1 Maria Colgan Master Product Manager Oracle Database Server Technologies June 2018 JEFF @SQLMaria
  • 2. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | B-Tree Indexes – Available since 5, they are the most common type of index – Goal: minimize time to find small amounts of data – Including function-based, Reverse Key Indexes, & IOTs – One to one mapping, little degradation in retrieval performance as underlying table grows Bitmap Indexes – Available since 7.3, designed for read-mostly workloads – Goal: Improve performance of ad-hoc analytic queries – A single bitmap key entry points to many rows – Multiple indexes can be used together to determine rowids – Bitmap Join indexes replaces need for two table join 2 Text Search Indexes – Available since 8i designed for text retrieval – Goal: Quickly identify large coherent documents – Can index documents of different formats such as MS Word, HTML or plain text – A single entry points to many documents Oracle Offers a Variety of Different Indexing Techniques Root Block leaf Blocks Branch Blocks
  • 3. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Reverse Key Indexes • Reverse key indexes physically stores the bytes of the keys in reverse order – CREATE INDEX sales_prod_reverse_idx ON sales(prod_id) REVERSE; • Used to avoid “hot block syndrome” or buffer busy waits – On columns with monotonically increasing values – Eg: sequence populated fields or dates/timestamps • At a cost – Prevents some index range scans as 5 is not stored next to 6 • Equality predicates on non-unique index will use index range scan • Range predicates such as between, <, > etc. may not use index – Additional CPU evident mostly in single user mode, with multi-users you see less overall CPU because you are not spinning on a buffer wait Relieving Index contention
  • 4. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Partially Useable Indexes • Enables the creation of local or global indexes on just a subset of partitions • Indexing only the stable partitions (little or no DML) minimizes the impact on ingest performance • Queries accessing data only within the indexed partitions will use the index • Queries that access data only in the non-indexed partitions will do full scan • Queries accessing partitions with and without indexes can take advantage of the query transformation called Table Expansion • Supported by definition on Partition views 4 Relieving Index contention
  • 5. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Partially Useable Indexes CREATE TABLE sales(order_status char(6) not null, order_date…) INDEXING ON PARTITION BY LIST (order_status)( PARTITION p1 VALUES(‘OPEN’) INDEXING OFF, PARTITION p2 VALUES(‘CLOSED’)); 5 Relieving Index contention
  • 6. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Table Expansion Transformation 6 P1: ORDER_STATUS=‘OPEN’ SELECT * FROM sales WHERE ORDER_DATE between‘2017-01-01’ and ‘2017-12-31’; P2: ORDER_STATUS=‘CLOSED’ P1: Best access path is full table scan SALES P2: Best access path is index scan Local index on ORDER_DATE IDX_SALES: ORDER_DATE
  • 7. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Table Expansion Transformation ---------------------------------------------------------------------- | Id | Operation | Name | Pstart| Pstop | ---------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | | | 1 | SORT AGGREGATE | | | | | 2 | VIEW | VW_TE_2 | | | | 3 | UNION-ALL | | | | | 4 | PARTITION RANGE SINGLE | | 1 | 1 | |* 5 | TABLE ACCESS FULL | SALES | 1 | 1 | | 6 | PARTITION RANGE SINGLE | | 2 | 2 | |* 7 | INDEX RANGE SCAN | IDX_SALES | 2 | 2 | ---------------------------------------------------------------------- 5 - access("ORDER_DATE“>=TO_DATE(' 2017-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "ORDER_DATE"<=TO_DATE(' 2018-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) filter("ORDER_DATE“>=TO_DATE(' 2017-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "ORDER_DATE"<=TO_DATE(' 2018-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) 7 - access("ORDER_DATE“>=TO_DATE(' 2017-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "ORDER_DATE"<=TO_DATE(' 2018-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
  • 8. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Indexing Nulls • Bitmap indexes – always index nulls • B*Tree cluster indexes – always index nulls • B*Tree indexes do not if and only if the entire key is null (all columns) 8 CREATE INDEX i ON t(object_id,0); SELECT * FROM t WHERE object_id is NULL; ------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1445 | 149K| 96 (0)| 00:00:02 | | 1 | TABLE ACCESS BY INDEX ROWID| T | 1445 | 149K| 96 (0)| 00:00:02 | |* 2 | INDEX RANGE SCAN | I | 1445 | | 7 (0)| 00:00:01 | -------------------------------------------------------------------------------------
  • 9. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 9 • How do I know which indexes are actually needed? • New DBA_INDEX_USAGE views provide usage histograms and access details for all indexes • Track index usage with no overhead Index Usage Statistics Public
  • 10. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Index Usage Statistics 10Public Index entries with no statistics indicate indexes that currently are not being used These are potential candidates to be deleted
  • 11. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | INVISIBLE Indexes • Ability to create and maintains an index that the optimizer is blind to – Optimizer can’t use an invisible index as an access method • Easy mechanism to begin the process of removing unused indexes 1. Mark the index invisible ALTER INDEX i INVISIBLE; 2. If no one misses it for a complete business cycle, its safe to drop it • Also useful to test out the benefit of a new index before publishing it 1. Create invisible index CREATE INDEX i ON t(x, object_id) INVISIBLE; 2. Set parameter OPTIMIZER_USE_INVISIBLE_INDEXES to true in 1 session to test ALTER SESSION SET optimizer_use_invisible_indexes=true;
  • 12. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Indexes are a critical tool to help improve performance 12 Indexes ORACLE Use them wisely to greatly improve speed of data access ….. …Over use them and you will grind the system to a halt!