Más contenido relacionado La actualidad más candente (20) Similar a Beyond SQL Tuning: Insider's Guide to Maximizing SQL Performance (20) Beyond SQL Tuning: Insider's Guide to Maximizing SQL Performance1. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Beyond SQL Tuning: Insider's
Guide to Maximizing SQL
Performance
Monday, Oct 22
10:30 a.m. - 11:15 a.m.
Marriott Marquis (Golden Gate Level) - Golden Gate A
Ashish Agrawal
Group Product Manager
Oracle Management Cloud
Oracle Corporation
OCT 22, 2018
Confidential – Oracle Internal/Restricted/Highly Restricted
2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, timing, and pricing of any
features or functionality described for Oracle’s products may change and remains at the
sole discretion of Oracle Corporation.
Confidential – Oracle Internal/Restricted/Highly Restricted
3. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Beyond SQL Tuning: Insider's Guide to Maximizing SQL
Performance
• Automatic Workload Repository (AWR), Active Session History (ASH) and
SQL monitoring hold a wealth of SQL performance data. SQL Analytics
leverages the rich SQL data in AWR, ASH, and SQL monitoring data using
purpose-built machine learning to provide unique insights into SQL
performance problems for your enterprise databases running on premise
or on cloud. In this session learn to recognize patterns of SQL performance
issues across all your Oracle Databases; perform a historical, comparative
analysis to find any SQL bottlenecks or plan regression; and identify SQL
performance anomalies and their root causes
Confidential – Oracle Internal/Restricted/Highly Restricted
4. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Challenges for DBA in managing DB and SQL Performance
DB and SQL - Diagnostics and Tuning
Advanced Database and SQL Analytics
Remediation
Oracle Autonomous Database
1
2
3
4
5
Confidential – Oracle Internal/Restricted/Highly Restricted 4
5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Challenges for DBA in managing DB and SQL Performance
DB and SQL - Diagnostics and Tuning
Advanced Database and SQL Analytics
Remediation
Oracle Autonomous Database
1
2
3
4
5
Confidential – Oracle Internal/Restricted/Highly Restricted 5
6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Challenges for DBA in managing DB and SQL Performance
Find problem DB and SQL when DBAs are responsible for large number of databases
Current tools focus on monitoring and diagnostics of one DB at a time
Which DB and SQL is in most need of their attention in future?
Being always reactive, how can a DBA be more proactive?
Data collection and analysis needed
Out of the box answers missing
Confidential – Oracle Internal/Restricted/Highly Restricted
7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Challenges for DBA in managing DB and SQL Performance
Difficult to identify trends and patterns in DB and SQL performance
Very little long term DB and SQL history
Limited advanced analytics capabilities like correlation, trending
Difficult to compare performance between production and staging DB
Confidential – Oracle Internal/Restricted/Highly Restricted
8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Challenges for DBA in managing DB and SQL Performance
DB and SQL - Diagnostics and Tuning
Advanced Database and SQL Analytics
Remediation
Oracle Autonomous Database
1
2
3
4
5
Confidential – Oracle Internal/Restricted/Highly Restricted 8
9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Which Database Performance Diagnostics Tool to Use?
Automatic Workload Repository – AWR Reports
• Reports about performance and workload data from AWR
Active Session History – ASH
Gathers fine-grain data about every active database session every second
Automatic Database Diagnostics Monitor - ADDM
• Data Analysis and Problem Identification
• Findings and Advise on how best to resolve bottlenecks
Real-time SQL and Database Operations Monitoring
• Provides in-depth diagnostics about SQL execution at row source level
Oracle Confidential – Internal/Restricted/Highly Restricted 9
10. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Reactive Performance Management
• Unfortunately we are not always in control
• Use Oracle Enterprise Manager to deal with production issues
Issue EM solution
– Analyzing transient performance problems ASH Analytics
– Diagnose persistent performance issues ADDM
– In-depth SQL performance analysis Real-Time SQL Monitoring
– Optimizing top SQL’s with sub-optimal plans SQL Tuning Advisor
Oracle Confidential – Internal/Restricted/Highly Restricted 10
11. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Challenges for DBA in managing DB and SQL Performance
DB and SQL - Diagnostics and Tuning
Advanced Database and SQL Analytics
Remediation
Oracle Autonomous Database
1
2
3
4
5
Confidential – Oracle Internal/Restricted/Highly Restricted 11
12. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Database Performance Analytics
Collects performance metrics, AWR & ASH data
Provides insights by running analytics on this data
Stores 13 months worth of selective, aggregated AWR and ASH data
Supports Oracle EE, Oracle SE, MySQL and MS SQL Server
Confidential – Oracle Internal/Restricted/Highly Restricted
13. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Database Performance Analytics use cases: Out of the box
answers
Databases gradually degrading in performance
Databases with unpredictable performance
Inefficient databases not taking advantage of compute resources
Automatic performance analysis of databases across enterprise
Confidential – Oracle Internal/Restricted/Highly Restricted
14. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
SQL Analytics: SQL Warehouse
SQL warehouse collects SQL performance data
• ASH data – aggregates, samples
• SQLSTATs
• SQL Text
• SQL execution Plan hash value
Automatic performance analysis of SQLs consuming more than 1% Database Time
Scalable for 1000’s of databases
Drill down into a set of SQL/ individual SQL to narrow down cause of a trend or an anomaly
Supports Oracle Enterprise Edition with Diagnostics Pack
Oracle Confidential – Internal/Restricted/Highly Restricted 14
15. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
SQL Analytics use cases: Out of the box answers
Identify SQLs with performance degradation, unpredictable performance,
inefficient SQLs and changing execution plans
Identify Top SQLs by resource usage
Compare SQL performance across databases (production vs. staging)
SQL Performance Insights
15
16. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
OMC Architecture
Oracle Confidential – Internal
With Gateway and OEM Integration
Corporate
Proxy
(optional)
Gateway
Cloud
Agent
REST APIs
16
HTTPS
(3872,1830-1839)
HTTPS
(443)
HTTPS
(3872,1830-1839)
SSH
SQL
APM
Agent
Data
Collector
OEM
Repository
HTTPS
(443)
Corporate
Firewall
End User
End User
HTTPS
(3872,1830-1839)
17. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Identify problem DBs that needs attention
Performance Degradation
- Identify databases whose performance has degraded over time and is correlated with change in demand
- Identify negative correlations between performance trends and demand
Variable Performance
- Symptomatic of unpredictable workload and application response times
- Identify databases with high degree of variance in SQL response time
Database Inefficiency
- Database workloads where large % of the database time in spent in application waits (not on CPU or I/O)
- Not taking advantage of compute resources
- For example enq: TX – row lock contention, library cache lock
Oracle Confidential – Internal/Restricted/Highly Restricted 17
18. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Databases with performance degradation
Analyzing Demand with Database Time
Demand = Executions and Activity = Database Time
Linear regression technique used to analyze Activity and Demand
Confidential – Oracle Internal/Restricted/Highly Restricted 18
Change in Response Time Change in Demand
Database Degradation
with decrease in demand
> + 20% < -10 %
Database Degradation
without change in demand
> +20% Between -10 % and +10%
19. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Databases with unpredictable performance
Applications workloads needs very stable and predictable Response Times
Important to focus on DBs with unpredictable performance
Confidential – Oracle Internal/Restricted/Highly Restricted 19
Relative variability of SQL = stdev(SQL Response Time) / avg(SQL Response Time)
Variant SQL when relative variability > 1.66
To calculate the % of workload caused by variant SQL:
For each db{
1) Calculate which SQLs are variant over the time period
2) Calculate the elapsed time for each variant SQL
3) Variant workload performance = sum( step 2) / total elapsed time on db}
20. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Inefficient databases not taking advantage of compute
resources
Inefficient wait time is in Active Sessions which are not part of
CPU Time, IO wait Time and idle wait events
Examples of inefficient waits are library cache lock, enqueue waits etc
Confidential – Oracle Internal/Restricted/Highly Restricted
Inefficient (%) = inefficient wait time / IO + CPU + inefficient wait time
Increasingly inefficient among the most inefficient databases = DBs with inefficient (%) > 50 % and inefficiency (%)
increasing over time
21. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Inefficient databases not taking advantage of compute
resources
View and compare the breakdown of inefficient waits, CPU and IO wait
Check estimated database performance that can be gained by eliminating
inefficient waits
Focus on increasingly inefficient databases
This databases and workloads represent the best tuning opportunity, so that the
application can perform even better
Confidential – Oracle Internal/Restricted/Highly Restricted
22. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Identify problem SQLs and SQL Performance Insights that
needs attention
22
Degrading SQL Response Time increases by more than 20% by linear
regression
Variant (unpredictable) SQLs Relative variability > 1.66
Inefficient SQL SQL with inefficiency > 20% by linear regression
SQLs with execution plan changes Execution plan hash value of the SQL changes
Top SQLs by resource usage Consumes a disproportionate amount of system
resources
SQL Performance Insights Commonality and unique findings across enterprise
wide SQL performance issues
23. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Identify degrading SQLs
Identifies SQLs that were good but now turned bad
Is the degradation due to same workload or change in magnitude of same workload
Provides fine grained details of an individual SQL for a particular database
Execution plan hash values can help identify cause of degradation
- Increase in execution time with same plan or different plan
Look up for same SQL across multiple databases and find out if it’s system wide regression or limited to a database
Confidential – Oracle Internal/Restricted/Highly Restricted
24. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Identify variant (unpredictable) SQLs
Identify SQLs whose Response Time is unpredictable and varying
Identify the nature of degradation
- slowly building vs sudden change vs cyclic pattern
Recommended to focus on this SQL to get more predicable workload performance
Confidential – Oracle Internal/Restricted/Highly Restricted
Relative variability SQL Response Time
0 and < than 1.66 Predictable and stable
> than 1.66 Unpredictable
> than 3.0 Highly unpredictable
25. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Identify inefficient SQLs
Identify SQLs that are cause of a particular inefficiency
- Example lock waits caused by row level locking or explicit lock commands
Waits are application related
Individual SQL level inefficiency
Trend inefficiencies issues at SQL level
Reducing inefficient waits will result in improved SQL performance
- Increasing hardware resources or power will typically have limited impact on performance and improving efficiency
- Improving application code and logic is required to make the application more efficient
Confidential – Oracle Internal/Restricted/Highly Restricted
26. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Fast running queries may turn slow if
the new execution plan is bad
SQL query changing plans frequently
may be variant in performance
Identifies SQLs with changing
execution plans by tracking execution
plan hash values
Stale/Missing statistics
Overly general statistics or incorrect histograms
Improper optimizer configuration
Upgraded database: new optimizer
Changing statistics (refresh)
Changing data (plans do not scale with data)
Bind-sensitive SQL with bind peeking
Not parallelized (no scaling to large data)
Improperly parallelized (skews, RAC, etc.)
Confidential – Oracle Internal/Restricted/Highly Restricted
Identify SQLs with execution plan changes
27. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Identify Top SQLs by resource usage
Causes a large impact on database performance
Identify high-load SQL using Top SQLs by CPU and IO across the enterprise wide DB’s
Identify SQLs which have the highest growth in CPU and IO usage using color key
Group by various dimensions
• Active Sessions, Executions/Hour, Average Response Time. I/O Time, CPU Time
Confidential – Oracle Internal/Restricted/Highly Restricted
28. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
SQL Performance Insights
Clustering to see commonality across enterprise wide SQL performance issues
• 14 of the 23 degrading SQLs have increasing I/O Time above 50%
• 6 of the 8 variant SQLs have plan changes
• 22 of the 51 degrading SQLs have increasing CPU Time above 50%
Statistical analysis to find issues with more impact
• n sqls that contribute to 80% of dbtime
Automatic baselines and anomaly detection for individual SQL
Histogram of SQL execution Response Time
Confidential – Oracle Internal/Restricted/Highly Restricted
29. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Compare SQL performance across databases (production
vs. development)
Compare SQL performance trend across databases for the same SQL by
- Average Response Time, Executions Per Hour, I/O Time, CPU Time
Compare SQL performance trend across execution plan hash value for the same SQL within the same database by
- Average Response Time, Executions Per Hour, I/O Time, CPU Time
Helps to identify SQL “A” degrading in production but not in staging DB
Compare execution plan hash value A before upgrade of DB to execution plan hash value B after upgrade
Confidential – Oracle Internal/Restricted/Highly Restricted
30. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Challenges for DBA in managing DB and SQL Performance
DB and SQL - Diagnostics and Tuning
Advanced Database and SQL Analytics
Remediation
Oracle Autonomous Database
1
2
3
4
5
Confidential – Oracle Internal/Restricted/Highly Restricted 30
31. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Remediation
31
Degrading SQL Response Time increases by more than
20% by linear regression
SQL Tuning Advisor
SQL Access Advisor
Variant (unpredictable) SQLs Relative variability > 1.66 Database, OS, storage tuning
SQL Plan Management
Inefficient SQL SQL with inefficiency > 20% by linear
regression
Application Tuning
SQLs with execution plan changes Execution plan hash value of the SQL
changes
SQL Plan Management
Top SQLs by resource usage Consumes a disproportionate amount
of system resources
SQL Tuning Advisor
SQL Access Advisor
There is no one-size-fits-all
32. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Challenges for DBA in managing DB and SQL Performance
DB and SQL - Diagnostics and Tuning
Advanced Database and SQL Analytics
Remediation
Oracle Autonomous Database
1
2
3
4
5
Confidential – Oracle Internal/Restricted/Highly Restricted 33
33. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Autonomous DB will automate most tasks for the
infrastructure DBA
App DBA still needs to monitor, diagnose and
perform basic app-level administrative operations
OMC provides management capabilities for these
operations
• Deep performance diagnostics and troubleshooting
• Cross tier application diagnostics
• Performance analytics - trending and utilization analytics
based on historical data
Oracle Autonomous Database
Move
Monitor
Diagnose
Manage
Analyze
34. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
What’s Really Happening in the Application?
Cross-tier Application Diagnostics
Challenge
• DBAs have no visibility on
how the applications have
been written
• Need for a common source
of information and context
that can be used by both
application support and DBA
teams (Devops)
Solution
• Complete visibility of
application performance, from
the app to the database
• Rapidly identify the root cause
of slowdowns for both
application and database tiers
• Deep visibility into SQL
execution, resource
consumption and DB Time to
help devops rapidly identify
the root cause of application
bottlenecks
35. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Cross-tier Application Diagnostics: APM Integration
Confidential – Oracle Internal/Restricted/Highly Restricted 37
36. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Cross-tier Application Diagnostics: App to SQL drill-down
Confidential – Oracle Internal/Restricted/Highly Restricted 38
37. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Analyze: Performance Analytics
Why: Poorly written applications will not perform efficiently even in
Autonomous DB
Solution: Database Performance Analytics
• Analyze Autonomous Database workloads to identify inefficiency caused by high waits and SQL
performance variability
Solution: SQL Analytics
• Drill down to SQLs contributing to high inefficiency and determine root cause of inefficiency
38. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Conclusion
Database and SQL Performance Analytics across enterprise
• Rapid time to value and lower operating costs
Provides trends and key insights to SQL performance problems
• Helps you to be proactive in future problem avoidance
Maximize database and SQL performance
• Increase business productivity by analyzing and remediating enterprise wide
causes of database and SQL performance problems
Confidential – Oracle Internal/Restricted/Highly Restricted
39. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 42
Global threat feeds
Cloud access
Identity
Real users
Synthetic users
App metrics
Transactions
Server metrics
Diagnostics logs
Host metrics
VM metrics
Container metrics
Configuration
Compliance
Tickets & Alerts
Security & Network
events
Comprehensive,
Intelligent
Management
Platform
Zero-effort
Operational
Insights
Automated
Preventative &
Corrective
Actions
APPLICATION
MIDDLE TIER
DATA TIER
VIRTUALIZATION TIER
INFRASTRUCTURE TIER
END USER
EXPERIENCE / ACTIVITY
Unified SaaS Platform
Application
Performance
Monitoring
Infrastructure
Monitoring
Log
Analytics
Configuration
& Compliance
Security
Monitoring &
Analytics
Orchestration
IT
Analytics
Oracle Management Cloud
40. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Q & A
feel free to ask
43