SlideShare une entreprise Scribd logo
1  sur  186
Performance Instrumentation for PL/SQL When, Why, How Karen Morton
Your speaker… ,[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],1
[object Object],[object Object],[object Object],2
[object Object],3
[object Object],[object Object],[object Object]
[object Object],4
[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]
[object Object]
[object Object]
[object Object],[object Object]
[object Object]
 
[object Object]
[object Object]
[object Object],[object Object]
[object Object]
[object Object],[object Object],waste
TCO $$ Waste Labor $$ Hardware $$ Software $$
[object Object]
[object Object]
[object Object]
[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
Why is this program slow? ,[object Object],[object Object],[object Object]
What is “slow”? ,[object Object],[object Object],[object Object],[object Object],[object Object]
So we open up our code. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Let’s find out. ,[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],[object Object],[object Object],[object Object],[object Object],[object Object]
So now we know. ,[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],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object],Procedure q: 1 Procedure r: 114 Procedure s: 15 Total R  : 130
[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],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object]
Day 1 Depart 7:40am Arrive 8:20am
[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
[object Object]
[object Object]
Category Miles Elapsed Time (minutes) Neighborhood 1 3 Burke Centre Pkwy 2.5 8 Fairfax County Pkwy 6 12 I-66 2.5 8 Hwy 28 2 5 Westfields Blvd to Office 1.5 4 Total 15.5 40 minutes
[object Object]
[object Object]
[object Object]
Conclusion Leave earlier to allow for traffic fluctuations
[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object]
Creates monitoring mechanisms
Tracks and measures performance
[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object]
[object Object],[object Object]
What are the benefits of proper instrumentation?
[object Object],[object Object],[object Object]
[object Object],[object Object]
This?
Or this?
This?
Or this?
[object Object],[object Object],[object Object],[object Object],Easily answer questions like:
[object Object],[object Object]
How do I instrument my code?
[object Object],[object Object]
[object Object]
[object Object],[object Object],[object Object],[object Object]
Lets instance  know which  end users are on which  connection
[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],[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],[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],[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]
[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],[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],[object Object],SELECT * FROM V$CLIENT_STATS
SELECT * FROM V$SERV_MOD_ACT_STATS when using serv_mod_act_stat_enable
Where should I place instrumentation?
[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]
[object Object],[object Object],[object Object]
[object Object]
PROCEDURE get_emp_simple_instr IS fnlist_stack fnlist_tab; lnlist_stack lnlist_tab;  BEGIN   DBMS_APPLICATION_INFO.set_module(module_name => 'Human  Resources’,action_name => 'Get Employees');     SELECT first_name, last_name BULK COLLECT   INTO  fnlist_stack, lnlist_stack   FROM  employees;     DBMS_APPLICATION_INFO.set_module(NULL, NULL); EXCEPTION   WHEN OTHERS THEN   DBMS_APPLICATION_INFO.set_module(NULL, NULL);   DBMS_OUTPUT.PUT_LINE('get_emp_simple_instr => ERROR'); END get_emp_simple_instr;
08:00:00 MODULE = ‘Human resources’ ACTION= ‘get employees’ 08:02:04 MODULE = null ACTION = null
PROCEDURE get_emp_jobs_instr_flawed IS   jtlist_stack jtlist_tab;   lnlist_stack lnlist_tab;  BEGIN DBMS_APPLICATION_INFO.set_module(module_name => 'Human Resources', action_name => 'Get Employees and Jobs');   get_emp_simple_instr;     SELECT last_name, job_title BULK COLLECT   INTO  lnlist_stack, jtlist_stack   FROM  employees e, jobs j   WHERE  e.job_id = j.job_id;     DBMS_APPLICATION_INFO.set_module(NULL, NULL); EXCEPTION WHEN OTHERS THEN DBMS_APPLICATION_INFO.set_module(NULL, NULL);  DBMS_OUTPUT.PUT_LINE('get_emp_jobs_instr_flawed => ERROR'); END get_emp_jobs_instr_bad;
08:10:00 MODULE = ‘Human resources’ ACTION = ‘get employees and jobs’ 08:12:04 MODULE = null ACTION = null 08:10:01 MODULE = ‘Human resources’ ACTION = ‘get employees’ 08:13:32 <end>
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
PROCEDURE get_emp_instr_good IS   fnlist_stack  fnlist_tab;   lnlist_stack  lnlist_tab;   preModuleName VARCHAR2(48) := NULL;   preActionName VARCHAR2(32) := NULL;  BEGIN   DBMS_APPLICATION_INFO.read_module( module_name => preModuleName, action_name => preActionName);   DBMS_APPLICATION_INFO.set_module( module_name => 'Human Resources', action_name => 'Get Employees');     SELECT first_name, last_name BULK COLLECT   INTO  fnlist_stack, lnlist_stack   FROM  employees;     DBMS_APPLICATION_INFO.set_module( module_name => preModuleName, action_name => preActionName); EXCEPTION   WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('HR_Package.get_emp_instr_good ERROR');   DBMS_APPLICATION_INFO.set_module( module_name => preModuleName, action_name => preActionName); END get_emp_instr_good;
[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]
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],Open  Source !
[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],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object]
[object Object],[object Object]
PROCEDURE get_emp_instr_better IS fnlist_stack  fnlist_tab; lnlist_stack  lnlist_tab; BEGIN ILO_TASK.BEGIN_TASK(module_name => 'Human Resources'   ,action_name => 'Get Employees');   SELECT first_name, last_name BULK COLLECT   INTO  fnlist_stack, lnlist_stack   FROM  employees;   ILO_TASK.END_TASK; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('get_emp_instr_better ERROR'); ILO_TASK.END_TASK; END get_emp_instr_better;
[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]
[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],[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]
[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],[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object]
Majority of time spent waiting for gc cr multi block request
Further drilldown showed  one insert and one delete to be largest “R” contributors
Reviewed the insert statement which was actually inserting via a SELECT
1) Noted excessive LIO 2) Plan showed use of full table scan
[object Object]
Added index on ts_row_seq
[object Object],[object Object],[object Object]
New response time 10.118 seconds
[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]
[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],[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],[object Object]
[object Object]
Questions & Answers
 

Contenu connexe

Tendances

Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Michael Rosenblum
 
Trigger and cursor program using sql
Trigger and cursor program using sqlTrigger and cursor program using sql
Trigger and cursor program using sql
Sushil Mishra
 

Tendances (20)

Procedures/functions of rdbms
Procedures/functions of rdbmsProcedures/functions of rdbms
Procedures/functions of rdbms
 
Plsql
PlsqlPlsql
Plsql
 
Oracle: PLSQL
Oracle: PLSQLOracle: PLSQL
Oracle: PLSQL
 
PL/SQL Fundamentals I
PL/SQL Fundamentals IPL/SQL Fundamentals I
PL/SQL Fundamentals I
 
Stored procedure
Stored procedureStored procedure
Stored procedure
 
Sql Functions And Procedures
Sql Functions And ProceduresSql Functions And Procedures
Sql Functions And Procedures
 
Function & procedure
Function & procedureFunction & procedure
Function & procedure
 
Plsql
PlsqlPlsql
Plsql
 
A New View of Database Views
A New View of Database ViewsA New View of Database Views
A New View of Database Views
 
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
 
PL/SQL
PL/SQLPL/SQL
PL/SQL
 
PL/SQL User-Defined Functions in the Read World
PL/SQL User-Defined Functions in the Read WorldPL/SQL User-Defined Functions in the Read World
PL/SQL User-Defined Functions in the Read World
 
Plsql guide 2
Plsql guide 2Plsql guide 2
Plsql guide 2
 
Oracle: Cursors
Oracle: CursorsOracle: Cursors
Oracle: Cursors
 
New features of SQL in Firebird
New features of SQL in FirebirdNew features of SQL in Firebird
New features of SQL in Firebird
 
Introduction to PL/SQL
Introduction to PL/SQLIntroduction to PL/SQL
Introduction to PL/SQL
 
04 Handling Exceptions
04 Handling Exceptions04 Handling Exceptions
04 Handling Exceptions
 
Developer's Approach to Code Management
Developer's Approach to Code ManagementDeveloper's Approach to Code Management
Developer's Approach to Code Management
 
Trigger and cursor program using sql
Trigger and cursor program using sqlTrigger and cursor program using sql
Trigger and cursor program using sql
 
Oracle - Program with PL/SQL - Lession 16
Oracle - Program with PL/SQL - Lession 16Oracle - Program with PL/SQL - Lession 16
Oracle - Program with PL/SQL - Lession 16
 

En vedette

Managing SQL Performance
Managing SQL PerformanceManaging SQL Performance
Managing SQL Performance
Karen Morton
 
Eff Plsql
Eff PlsqlEff Plsql
Eff Plsql
afa reg
 
Orientamenti di social media marketing
Orientamenti di social media marketingOrientamenti di social media marketing
Orientamenti di social media marketing
Communication Village
 

En vedette (20)

Managing SQL Performance
Managing SQL PerformanceManaging SQL Performance
Managing SQL Performance
 
Quản lý âm nhạc
Quản lý âm nhạcQuản lý âm nhạc
Quản lý âm nhạc
 
Date rangestech15
Date rangestech15Date rangestech15
Date rangestech15
 
Eff Plsql
Eff PlsqlEff Plsql
Eff Plsql
 
Quản lý bóng đá
Quản lý bóng đáQuản lý bóng đá
Quản lý bóng đá
 
SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)
 
Hệ thống quản lý rạp chiếu phim
Hệ thống quản lý          rạp chiếu phimHệ thống quản lý          rạp chiếu phim
Hệ thống quản lý rạp chiếu phim
 
The Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result CacheThe Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result Cache
 
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
Row Pattern Matching 12c MATCH_RECOGNIZE OOW14
 
Impact Analysis with PL/Scope
Impact Analysis with PL/ScopeImpact Analysis with PL/Scope
Impact Analysis with PL/Scope
 
Phân tích và thiết kế hệ thống quản lý bán hàng
Phân tích và thiết kế hệ thống quản lý bán hàngPhân tích và thiết kế hệ thống quản lý bán hàng
Phân tích và thiết kế hệ thống quản lý bán hàng
 
đồ áN phân tích thiết kế hệ thống quản lý bán hàng siêu thị
đồ áN phân tích thiết kế hệ thống quản lý bán hàng siêu thịđồ áN phân tích thiết kế hệ thống quản lý bán hàng siêu thị
đồ áN phân tích thiết kế hệ thống quản lý bán hàng siêu thị
 
All About PL/SQL Collections
All About PL/SQL CollectionsAll About PL/SQL Collections
All About PL/SQL Collections
 
Spasovo
SpasovoSpasovo
Spasovo
 
Socialist Software Development - RubyConf 2010
Socialist Software Development - RubyConf 2010Socialist Software Development - RubyConf 2010
Socialist Software Development - RubyConf 2010
 
Q.Ind.Quimica
Q.Ind.QuimicaQ.Ind.Quimica
Q.Ind.Quimica
 
Orientamenti di social media marketing
Orientamenti di social media marketingOrientamenti di social media marketing
Orientamenti di social media marketing
 
ICF Energy Efficiency in HOME Affordable Housing Manual
ICF Energy Efficiency in HOME Affordable Housing ManualICF Energy Efficiency in HOME Affordable Housing Manual
ICF Energy Efficiency in HOME Affordable Housing Manual
 
A Long Walk to Water: Lesson16 unit2
A Long Walk to Water: Lesson16 unit2A Long Walk to Water: Lesson16 unit2
A Long Walk to Water: Lesson16 unit2
 
Slavery Module: Lesson three
Slavery Module: Lesson threeSlavery Module: Lesson three
Slavery Module: Lesson three
 

Similaire à Performance Instrumentation for PL/SQL: When, Why, How

Advance Sql Server Store procedure Presentation
Advance Sql Server Store procedure PresentationAdvance Sql Server Store procedure Presentation
Advance Sql Server Store procedure Presentation
Amin Uddin
 
Workflow demo
Workflow demoWorkflow demo
Workflow demo
Kamal Raj
 
How to analyze_table_through_informatica
How to analyze_table_through_informaticaHow to analyze_table_through_informatica
How to analyze_table_through_informatica
sushantbit04
 
...and thus your forms automagically disappeared
...and thus your forms automagically disappeared...and thus your forms automagically disappeared
...and thus your forms automagically disappeared
Luc Bors
 

Similaire à Performance Instrumentation for PL/SQL: When, Why, How (20)

Advance Sql Server Store procedure Presentation
Advance Sql Server Store procedure PresentationAdvance Sql Server Store procedure Presentation
Advance Sql Server Store procedure Presentation
 
Sql storeprocedure
Sql storeprocedureSql storeprocedure
Sql storeprocedure
 
Workflow demo
Workflow demoWorkflow demo
Workflow demo
 
Sherlock holmes for dba’s
Sherlock holmes for dba’sSherlock holmes for dba’s
Sherlock holmes for dba’s
 
Oracle Sql Tuning
Oracle Sql TuningOracle Sql Tuning
Oracle Sql Tuning
 
Stored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayiStored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayi
 
Module Owb Tuning
Module Owb TuningModule Owb Tuning
Module Owb Tuning
 
How to analyze_table_through_informatica
How to analyze_table_through_informaticaHow to analyze_table_through_informatica
How to analyze_table_through_informatica
 
Apex code Benchmarking
Apex code BenchmarkingApex code Benchmarking
Apex code Benchmarking
 
Carasik BPM ECM
Carasik BPM ECMCarasik BPM ECM
Carasik BPM ECM
 
...and thus your forms automagically disappeared
...and thus your forms automagically disappeared...and thus your forms automagically disappeared
...and thus your forms automagically disappeared
 
Module04
Module04Module04
Module04
 
Performance tuning a quick intoduction
Performance tuning   a quick intoductionPerformance tuning   a quick intoduction
Performance tuning a quick intoduction
 
Data Mining and Analytics
Data Mining and AnalyticsData Mining and Analytics
Data Mining and Analytics
 
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
 
Microsoft SQL Server Query Tuning
Microsoft SQL Server Query TuningMicrosoft SQL Server Query Tuning
Microsoft SQL Server Query Tuning
 
SQL Server Performance Tuning with DMVs
SQL Server Performance Tuning with DMVsSQL Server Performance Tuning with DMVs
SQL Server Performance Tuning with DMVs
 
Telecom Churn Analysis
Telecom Churn AnalysisTelecom Churn Analysis
Telecom Churn Analysis
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
SQL Optimization With Trace Data And Dbms Xplan V6
SQL Optimization With Trace Data And Dbms Xplan V6SQL Optimization With Trace Data And Dbms Xplan V6
SQL Optimization With Trace Data And Dbms Xplan V6
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Performance Instrumentation for PL/SQL: When, Why, How

  • 1. Performance Instrumentation for PL/SQL When, Why, How Karen Morton
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.  
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. TCO $$ Waste Labor $$ Hardware $$ Software $$
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53. Day 1 Depart 7:40am Arrive 8:20am
  • 54.
  • 55.
  • 56.
  • 57.
  • 58. Category Miles Elapsed Time (minutes) Neighborhood 1 3 Burke Centre Pkwy 2.5 8 Fairfax County Pkwy 6 12 I-66 2.5 8 Hwy 28 2 5 Westfields Blvd to Office 1.5 4 Total 15.5 40 minutes
  • 59.
  • 60.
  • 61.
  • 62. Conclusion Leave earlier to allow for traffic fluctuations
  • 63.
  • 64.
  • 65.
  • 67. Tracks and measures performance
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73. What are the benefits of proper instrumentation?
  • 74.
  • 75.
  • 76. This?
  • 78. This?
  • 80.
  • 81.
  • 82. How do I instrument my code?
  • 83.
  • 84.
  • 85.
  • 86. Lets instance know which end users are on which connection
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107. SELECT * FROM V$SERV_MOD_ACT_STATS when using serv_mod_act_stat_enable
  • 108. Where should I place instrumentation?
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115. PROCEDURE get_emp_simple_instr IS fnlist_stack fnlist_tab; lnlist_stack lnlist_tab; BEGIN DBMS_APPLICATION_INFO.set_module(module_name => 'Human Resources’,action_name => 'Get Employees'); SELECT first_name, last_name BULK COLLECT INTO fnlist_stack, lnlist_stack FROM employees; DBMS_APPLICATION_INFO.set_module(NULL, NULL); EXCEPTION WHEN OTHERS THEN DBMS_APPLICATION_INFO.set_module(NULL, NULL); DBMS_OUTPUT.PUT_LINE('get_emp_simple_instr => ERROR'); END get_emp_simple_instr;
  • 116. 08:00:00 MODULE = ‘Human resources’ ACTION= ‘get employees’ 08:02:04 MODULE = null ACTION = null
  • 117. PROCEDURE get_emp_jobs_instr_flawed IS jtlist_stack jtlist_tab; lnlist_stack lnlist_tab; BEGIN DBMS_APPLICATION_INFO.set_module(module_name => 'Human Resources', action_name => 'Get Employees and Jobs'); get_emp_simple_instr; SELECT last_name, job_title BULK COLLECT INTO lnlist_stack, jtlist_stack FROM employees e, jobs j WHERE e.job_id = j.job_id; DBMS_APPLICATION_INFO.set_module(NULL, NULL); EXCEPTION WHEN OTHERS THEN DBMS_APPLICATION_INFO.set_module(NULL, NULL); DBMS_OUTPUT.PUT_LINE('get_emp_jobs_instr_flawed => ERROR'); END get_emp_jobs_instr_bad;
  • 118. 08:10:00 MODULE = ‘Human resources’ ACTION = ‘get employees and jobs’ 08:12:04 MODULE = null ACTION = null 08:10:01 MODULE = ‘Human resources’ ACTION = ‘get employees’ 08:13:32 <end>
  • 119.
  • 120.
  • 121. PROCEDURE get_emp_instr_good IS fnlist_stack fnlist_tab; lnlist_stack lnlist_tab; preModuleName VARCHAR2(48) := NULL; preActionName VARCHAR2(32) := NULL; BEGIN DBMS_APPLICATION_INFO.read_module( module_name => preModuleName, action_name => preActionName); DBMS_APPLICATION_INFO.set_module( module_name => 'Human Resources', action_name => 'Get Employees'); SELECT first_name, last_name BULK COLLECT INTO fnlist_stack, lnlist_stack FROM employees; DBMS_APPLICATION_INFO.set_module( module_name => preModuleName, action_name => preActionName); EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('HR_Package.get_emp_instr_good ERROR'); DBMS_APPLICATION_INFO.set_module( module_name => preModuleName, action_name => preActionName); END get_emp_instr_good;
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.
  • 138. PROCEDURE get_emp_instr_better IS fnlist_stack fnlist_tab; lnlist_stack lnlist_tab; BEGIN ILO_TASK.BEGIN_TASK(module_name => 'Human Resources' ,action_name => 'Get Employees'); SELECT first_name, last_name BULK COLLECT INTO fnlist_stack, lnlist_stack FROM employees; ILO_TASK.END_TASK; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('get_emp_instr_better ERROR'); ILO_TASK.END_TASK; END get_emp_instr_better;
  • 139.
  • 140.
  • 141.
  • 142.
  • 143.
  • 144.
  • 145.
  • 146.
  • 147.
  • 148.
  • 149.
  • 150.
  • 151.
  • 152.
  • 153.
  • 154.
  • 155.
  • 156.
  • 157.
  • 158.
  • 159.
  • 160.
  • 161.
  • 162. Majority of time spent waiting for gc cr multi block request
  • 163. Further drilldown showed one insert and one delete to be largest “R” contributors
  • 164. Reviewed the insert statement which was actually inserting via a SELECT
  • 165. 1) Noted excessive LIO 2) Plan showed use of full table scan
  • 166.
  • 167. Added index on ts_row_seq
  • 168.
  • 169. New response time 10.118 seconds
  • 170.
  • 171.
  • 172.
  • 173.
  • 174.
  • 175.
  • 176.
  • 177.
  • 178.
  • 179.
  • 180.
  • 181.
  • 182.
  • 183.
  • 184.
  • 186.  

Notes de l'éditeur

  1. Course or presentation name © 2008 Method R Corp.
  2. Collect properly scoped , un-aggregated profile data for each task while the task is exhibiting the behavior you want to record Login Triggers Unique code changes
  3. Collect properly scoped , un-aggregated profile data for each task while the task is exhibiting the behavior you want to record Login Triggers Unique code changes
  4. … costs you money
  5. Your slow stuff will clog up even your fast stuff.
  6. “ Slow. Why?” Ok …What does “slow” mean?
  7. 129.98 seconds Why?
  8. 129.98 seconds (this is R data) Why? Where is the time spent? (we need profile data)
  9. Real-life performance instrumentation
  10. Real-life performance instrumentation
  11. Real-life performance instrumentation
  12. Test 1: I delivered the presentation to my cats. I used a stop watch to keep a running time My cats were thrilled to participate My test presentation was just short of 2 hours
  13. Emit a line-by-line execution of each step with a time stamp Available in any environment (e.g. development, production…) Always ready to be activated Easy to perform Light weight Uses built-in functionality as much as possible
  14. Enterprise Manager V$ views
  15. No idea of who are the clients Large amount of activity by unnamed modules and actions
  16. Know who the client is and be able to drilldown See specific module and action that are the “Top Consumers” Able to trace right from DBConsole and Grid Control
  17. Enterprise Manager V$ views
  18. Enterprise Manager V$ views
  19. Emit a line-by-line execution of each step with a time stamp Available in any environment (e.g. development, production…) Always ready to be activated Easy to perform Light weight Uses built-in functionality as much as possible
  20. Create a simple logon trigger to set CLIENT_IDENTIFIER CREATE OR REPLACE TRIGGER client_id_logon_trg AFTER LOGON ON DATABASE DECLARE my_service SYS.V_$SESSION.SERVICE_NAME%TYPE; my_clientid SYS.V_$SESSION.CLIENT_IDENTIFIER%TYPE; my_ip_address SYS.V_$SESSION.TERMINAL%TYPE; my_os_user SYS.V_$SESSION.OSUSER%TYPE; my_audsid SYS.V_$SESSION.AUDSID%TYPE; my_program SYS.V_$SESSION.PROGRAM%TYPE; CLIENT_ID_DELIM CHAR(1) := &apos;~&apos;; BEGIN IF USER NOT IN (&apos;SYS&apos;) AND USER IS NOT NULL THEN my_clientid := SYS_CONTEXT(&apos;USERENV&apos;, &apos;CLIENT_IDENTIFIER&apos;); IF my_clientid IS NULL THEN my_service := SYS_CONTEXT(&apos;USERENV&apos;, &apos;SERVICE_NAME&apos;); my_ip_address := NVL(SYS_CONTEXT(&apos;USERENV&apos;, &apos;IP_ADDRESS&apos;) ,SYS_CONTEXT(&apos;USERENV&apos;, &apos;TERMINAL&apos;)); my_os_user := SYS_CONTEXT(&apos;USERENV&apos;, &apos;OS_USER&apos;); my_audsid := TO_NUMBER(SYS_CONTEXT(&apos;USERENV&apos;, &apos;SESSIONID&apos;)); SELECT PROGRAM INTO my_program FROM SYS.V_$SESSION WHERE AUDSID = my_audsid AND ROWNUM = 1; DBMS_SESSION.SET_IDENTIFIER(my_os_user || CLIENT_ID_DELIM || my_ip_address || CLIENT_ID_DELIM || my_program || CLIENT_ID_DELIM || my_service); END IF; END IF; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(&apos;client_id_logon_trg: Exception thrown&apos;); END client_id_logon_trg;
  21. select column_name, table_name from dba_tab_cols where column_name like &apos;CLIENT_ID%&apos; order by table_name COLUMN_NAME TABLE_NAME ------------------------------ ------------------------------ CLIENT_ID ALL_SCHEDULER_JOBS CLIENT_ID ALL_SCHEDULER_JOB_LOG CLIENT_ID ALL_SCHEDULER_WINDOW_LOG CLIENT_ID DBA_AUDIT_EXISTS CLIENT_ID DBA_AUDIT_OBJECT CLIENT_ID DBA_AUDIT_SESSION CLIENT_ID DBA_AUDIT_STATEMENT CLIENT_ID DBA_AUDIT_TRAIL CLIENT_ID DBA_COMMON_AUDIT_TRAIL CLIENT_ID DBA_FGA_AUDIT_TRAIL CLIENT_ID DBA_HIST_ACTIVE_SESS_HISTORY CLIENT_ID DBA_SCHEDULER_JOBS CLIENT_ID DBA_SCHEDULER_JOB_LOG CLIENT_ID DBA_SCHEDULER_WINDOW_LOG CLIENT_IDENTIFIER GLOBAL_CONTEXT CLIENT_ID GV_$ACTIVE_SESSION_HISTORY CLIENT_IDENTIFIER GV_$CLIENT_STATS CLIENT_IDENTIFIER GV_$GLOBALCONTEXT CLIENT_IDENTIFIER GV_$SESSION CLIENT_ID KET$_CLIENT_CONFIG CLIENT_ID KET$_CLIENT_TASKS CLIENT_IDENTIFIER MGMT_USER_CONTEXT CLIENT_ID SCHEDULER$_EVENT_LOG CLIENT_ID SCHEDULER$_JOB CLIENT_ID SCHEDULER$_LIGHTWEIGHT_JOB CLIENT_ID USER_AUDIT_OBJECT CLIENT_ID USER_AUDIT_SESSION CLIENT_ID USER_AUDIT_STATEMENT CLIENT_ID USER_AUDIT_TRAIL CLIENT_ID USER_SCHEDULER_JOBS CLIENT_ID USER_SCHEDULER_JOB_LOG CLIENT_ID V_$ACTIVE_SESSION_HISTORY CLIENT_IDENTIFIER V_$CLIENT_STATS CLIENT_IDENTIFIER V_$GLOBALCONTEXT CLIENT_IDENTIFIER V_$SESSION CLIENT_ID WRH$_ACTIVE_SESSION_HISTORY CLIENT_ID WRH$_ACTIVE_SESSION_HISTORY_BL 37 rows selected.
  22. Valid values of dest parameter are 1 = Trace file, 2 = Alert log, 3 = Both
  23. Monitor sessions by querying v$session
  24. Valid values of dest parameter are 1 = Trace file, 2 = Alert log, 3 = Both
  25. Monitor sessions by querying v$session
  26. http://sourceforge.net/projects/hotsos-ilo/
  27. Turning on trace is usually a run-time decision ( DBMS_MONITOR ) The developer will simply include BEGIN_TASK ILO calls that will check to see if someone has requested that a trace be initiated For development testing, the developer simply calls SET_MARK_ALL_TASKS_INTERESTING (TRUE, TRUE) to express their intent to trace Calls to this method will not typically be present in production code Except perhaps via a menu option (Help &gt; Debug &gt; Trace)