SlideShare uma empresa Scribd logo
1 de 7
Baixar para ler offline
Tech Notes



New Tools for Faster SQL Tuning
and Analysis
Embarcadero Technologies

November 2009




Corporate Headquarters              EMEA Headquarters         Asia-Pacific Headquarters
100 California Street, 12th Floor   York House                L7. 313 La Trobe Street
San Francisco, California 94111     18 York Road              Melbourne VIC 3000
                                    Maidenhead, Berkshire     Australia
                                    SL6 1SF, United Kingdom
New Tools for Faster SQL Tuning and Analysis




INTRODUCTION
SQL tuning is complicated. The growing size and complexity of databases, innovations in
application development tools that automatically generate SQL code that is often inefficient,
and built in database optimizers that vary in their ability to pick the optimum execution path are
all common challenges within the realm of performance optimization. Adding to the complexity,
pressures to reduce hardware spending while meeting strict SLA and other performance
requirements are constantly pushing the limits of SQL profiling and tuning tools as well as the
expertise of the DBA. And now there is a growing trend to arm the developers themselves with
SQL optimization tools and integrate SQL tuning into the development lifecycle.

To achieve the best results under these circumstances, organizations should standardize on one
tool that serves the needs of the developer as well as the more advanced SQL tuning
techniques required by the DBA. Traditionally, DBAs use hint injections and SQL rewrites, but
now there are new innovations in SQL tuning like index analysis and, most recently, Visual SQL
Tuning (VST). These new innovations serve two masters; they reduce the complexity of SQL
tuning for the developer, while providing more detailed and advanced analysis for the DBA.


TRADITIONAL SQL TUNING
When you execute SQL on a particular database, the database uses its own internal optimizer to
determine the quickest execution path for that SQL, based on the way it is written, and a ‘cost’
is reflected in the resultant explain plan. Because the database vendors are continually
improving the performance of their respective optimizers, the database optimizer generally
picks the optimum path. There are, however, always cases where the optimizer needs to be
forced down a faster execution path in order to ensure the best possible performance. This
method is delivered through a hint that is injected into the SQL to direct the optimizer as the
SQL is executed.

Rather than injecting hints for the optimizer to follow, some DBAs prefer to rewrite the SQL to
accelerate the query. Examples of common SQL coding mistakes that can be repaired by SQL
rewrites include Cartesian join elimination, expression transformation, invalid outer join,
transitivity, and push sub-query to name a few. The one thing to be wary of with some SQL
rewrites is that the result set of the query could be affected, so it’s important to take this into
account when leveraging rewrites.

Embarcadero® DB Optimizer™ provides both hint injections and SQL rewrites for the DBA or
developer to use as they wish. The DB Optimizer tuning feature automatically examines an SQL
statement and suggests applicable hints as well as SQL rewrites in parallel, highlighting the SQL
rewrite options to ensure you are aware that the result set may be altered (i.e. missing a valid
join criteria).




Embarcadero Technologies                                                                         -1-
New Tools for Faster SQL Tuning and Analysis




             Figure 1: DB Optimizer offers both hint injection and SQL rewrites


INNOVATIONS IN SQL TUNING – INDEX
ANALYSIS AND VISUAL SQL TUNING
Most SQL tuning tools stop at hint injection and SQL rewrites, but DB Optimizer takes analysis
and tuning a step beyond with advances in index analysis and unparalleled innovation with
Visual SQL Tuning (VST) diagrams. Index Analysis empowers DBAs and developers to fully
examine SQL execution paths to better understand which indexes are used, not used, or
missing. And if an index is missing, DB Optimizer offers indexing recommendations for
optimum performance. The VST diagram displays indexes and constraints on tables and views,
as well as the joins used in a SQL statement. This innovative visual format quickly reveals
opportunities to tune the SQL or schema and enhance overall database performance.




Embarcadero Technologies                                                                   -2-
New Tools for Faster SQL Tuning and Analysis




    Figure 2: SQL Analysis tab displays Visual SQL Tuning diagrams and index analysis
 

ADVANCED INDEX ANALYSIS
Given a particular SQL statement and its variables (i.e., tables and columns used, join and filter
criteria, ordering in the ‘where clause’, etc.), the database-specific optimizer returns an explain
plan that charts the step-by-step execution path through the database, including the indexes
leveraged along the way. DB Optimizer takes this information as well as information about
existing indexes and charts them in four different ways: indexes that are being used (green);
indexes that exist but are not used by the database-specific optimizer (blue); indexes that exist
on the table but are not leveraged based on the existing ‘where clause’ (grey); and indexes that
do not exist but are suggested by DB Optimizer (orange).




                              Figure 3: Color-coded index analysis




Embarcadero Technologies                                                                        -3-
New Tools for Faster SQL Tuning and Analysis


In the case where the index does not exist, DB Optimizer allows you to generate the
recommended index at the click of a button. It is also very useful to understand when an index
is not being used. A developer might write an index in an attempt to speed up the query, but
then learn the optimizer is not using it for that query. This information gives the developer the
opportunity to rewrite the index to try to get the optimizer to use it or decide to remove the
index entirely if it is superfluous.

VISUAL SQL TUNING (VST) DIAGRAMS
Delivering a new level of innovation in SQL tuning, DB Optimizer can parse an SQL query and
analyze the indexes and constraints on the tables and views in the query and display the query
in graphical format. The resultant VST diagram, which can be displayed in either Summary
Mode or Detail Mode, helps developers and DBAs see flaws in the schema design such as
Cartesian joins, implied Cartesian joins, and many-to-many relationships. The VST diagram
helps you quickly understand the components of an SQL query, thus accelerating trouble-
shooting and analysis. This is a very useful feature for the DBA to initiate informed design
conversations with Data Architects for cross-organizational collaboration.




  Figure 4: Visual SQL Tuning diagram provides at-a-glance information about query or
                      schema design – in this case a Cartesian join

In the case above, where a Cartesian join is discovered, DB Optimizer resolves the performance
issue based on the results of analysis and rewrites the query.


CONCLUSION - BEST PRACTICES IN SQL
TUNING
When faced with a number of options, it is always a good idea to take a step back and look at
your existing workflow and insert best practices in each step of the process. The best way to
identify database bottlenecks caused by SQL is to start with a profiling session. Once DB
Optimizer has filtered out the worst-performing SQL code, you can import that SQL code


Embarcadero Technologies                                                                       -4-
New Tools for Faster SQL Tuning and Analysis


directly into the tuner and into the Input Tab. The Overview Tab displays case generation
using the SQL rewrites and hint injections. DB Optimizer’s Load Editor, a SQL stress testing
feature, lets you simulate parallel sessions and number of executions to measure any
performance gains side-by-side with pre-tuned and tuned SQL while profiling the database.
When classic tuning methods will not suffice or service levels are still out of reach after retesting,
the Analysis Tab reveals opportunities for advanced tuning methods.




Figure 5: DB Optimizer Analysis Tab offers both developers and DBAs the tool they need
                  to satisfy their respective SQL optimization needs.




Embarcadero Technologies                                                                          -5-
Embarcadero Technologies, Inc. is a leading provider of award-winning tools for application
developers and database professionals so they can design systems right, build them faster and
run them better, regardless of their platform or programming language. Ninety of the Fortune
100 and an active community of more than three million users worldwide rely on Embarcadero
products to increase productivity, reduce costs, simplify change management and compliance
and accelerate innovation. The company’s flagship tools include: Embarcadero® Change
Manager™, Embarcadero® RAD Studio, DBArtisan®, Delphi®, ER/Studio®, JBuilder® and Rapid
SQL®. Founded in 1993, Embarcadero is headquartered in San Francisco, with offices located
around the world. Embarcadero is online at www.embarcadero.com.

Mais conteúdo relacionado

Destaque (17)

MOW-slides
MOW-slidesMOW-slides
MOW-slides
 
История развития ВТ
История развития ВТИстория развития ВТ
История развития ВТ
 
El sistema nervioso m. carmen
El sistema nervioso m. carmenEl sistema nervioso m. carmen
El sistema nervioso m. carmen
 
Tendencias pedagogicas blanca dalia cabrera
Tendencias pedagogicas blanca  dalia cabreraTendencias pedagogicas blanca  dalia cabrera
Tendencias pedagogicas blanca dalia cabrera
 
e-Job Portals
e-Job Portalse-Job Portals
e-Job Portals
 
Trabajo de internacional publico
Trabajo de internacional publicoTrabajo de internacional publico
Trabajo de internacional publico
 
8º Ano Victor,Vivaine,Gabriel
8º Ano Victor,Vivaine,Gabriel8º Ano Victor,Vivaine,Gabriel
8º Ano Victor,Vivaine,Gabriel
 
Innovación, invención
Innovación, invenciónInnovación, invención
Innovación, invención
 
QUE ES UN BUSCADOR
QUE ES UN BUSCADORQUE ES UN BUSCADOR
QUE ES UN BUSCADOR
 
Trabajo de LUIS CABALLERO
Trabajo de LUIS CABALLERO Trabajo de LUIS CABALLERO
Trabajo de LUIS CABALLERO
 
7º Ano Patrick e Matheus Souza
7º Ano Patrick e Matheus Souza7º Ano Patrick e Matheus Souza
7º Ano Patrick e Matheus Souza
 
Trabajo de derecho internacional
Trabajo de derecho internacionalTrabajo de derecho internacional
Trabajo de derecho internacional
 
Valparatango 2012
Valparatango 2012Valparatango 2012
Valparatango 2012
 
El voleyballcali
El voleyballcaliEl voleyballcali
El voleyballcali
 
Obras, espaço, público
Obras, espaço, públicoObras, espaço, público
Obras, espaço, público
 
agricultura urbana
agricultura urbanaagricultura urbana
agricultura urbana
 
Trabajo de español
Trabajo de españolTrabajo de español
Trabajo de español
 

Mais de Embarcadero Technologies

PyTorch for Delphi - Python Data Sciences Libraries.pdf
PyTorch for Delphi - Python Data Sciences Libraries.pdfPyTorch for Delphi - Python Data Sciences Libraries.pdf
PyTorch for Delphi - Python Data Sciences Libraries.pdfEmbarcadero Technologies
 
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...Embarcadero Technologies
 
Linux GUI Applications on Windows Subsystem for Linux
Linux GUI Applications on Windows Subsystem for LinuxLinux GUI Applications on Windows Subsystem for Linux
Linux GUI Applications on Windows Subsystem for LinuxEmbarcadero Technologies
 
Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework Embarcadero Technologies
 
Introduction to Python GUI development with Delphi for Python - Part 1: Del...
Introduction to Python GUI development with Delphi for Python - Part 1:   Del...Introduction to Python GUI development with Delphi for Python - Part 1:   Del...
Introduction to Python GUI development with Delphi for Python - Part 1: Del...Embarcadero Technologies
 
FMXLinux Introduction - Delphi's FireMonkey for Linux
FMXLinux Introduction - Delphi's FireMonkey for LinuxFMXLinux Introduction - Delphi's FireMonkey for Linux
FMXLinux Introduction - Delphi's FireMonkey for LinuxEmbarcadero Technologies
 
Python for Delphi Developers - Part 1 Introduction
Python for Delphi Developers - Part 1 IntroductionPython for Delphi Developers - Part 1 Introduction
Python for Delphi Developers - Part 1 IntroductionEmbarcadero Technologies
 
RAD Industrial Automation, Labs, and Instrumentation
RAD Industrial Automation, Labs, and InstrumentationRAD Industrial Automation, Labs, and Instrumentation
RAD Industrial Automation, Labs, and InstrumentationEmbarcadero Technologies
 
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBase
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBaseEmbeddable Databases for Mobile Apps: Stress-Free Solutions with InterBase
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBaseEmbarcadero Technologies
 
Rad Server Industry Template - Connected Nurses Station - Setup Document
Rad Server Industry Template - Connected Nurses Station - Setup DocumentRad Server Industry Template - Connected Nurses Station - Setup Document
Rad Server Industry Template - Connected Nurses Station - Setup DocumentEmbarcadero Technologies
 
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinar
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinarMove Desktop Apps to the Cloud - RollApp & Embarcadero webinar
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinarEmbarcadero Technologies
 
Getting Started Building Mobile Applications for iOS and Android
Getting Started Building Mobile Applications for iOS and AndroidGetting Started Building Mobile Applications for iOS and Android
Getting Started Building Mobile Applications for iOS and AndroidEmbarcadero Technologies
 
ER/Studio 2016: Build a Business-Driven Data Architecture
ER/Studio 2016: Build a Business-Driven Data ArchitectureER/Studio 2016: Build a Business-Driven Data Architecture
ER/Studio 2016: Build a Business-Driven Data ArchitectureEmbarcadero Technologies
 
The Secrets of SQL Server: Database Worst Practices
The Secrets of SQL Server: Database Worst PracticesThe Secrets of SQL Server: Database Worst Practices
The Secrets of SQL Server: Database Worst PracticesEmbarcadero Technologies
 
Driving Business Value Through Agile Data Assets
Driving Business Value Through Agile Data AssetsDriving Business Value Through Agile Data Assets
Driving Business Value Through Agile Data AssetsEmbarcadero Technologies
 
Troubleshooting Plan Changes with Query Store in SQL Server 2016
Troubleshooting Plan Changes with Query Store in SQL Server 2016Troubleshooting Plan Changes with Query Store in SQL Server 2016
Troubleshooting Plan Changes with Query Store in SQL Server 2016Embarcadero Technologies
 

Mais de Embarcadero Technologies (20)

PyTorch for Delphi - Python Data Sciences Libraries.pdf
PyTorch for Delphi - Python Data Sciences Libraries.pdfPyTorch for Delphi - Python Data Sciences Libraries.pdf
PyTorch for Delphi - Python Data Sciences Libraries.pdf
 
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
 
Linux GUI Applications on Windows Subsystem for Linux
Linux GUI Applications on Windows Subsystem for LinuxLinux GUI Applications on Windows Subsystem for Linux
Linux GUI Applications on Windows Subsystem for Linux
 
Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework
 
Introduction to Python GUI development with Delphi for Python - Part 1: Del...
Introduction to Python GUI development with Delphi for Python - Part 1:   Del...Introduction to Python GUI development with Delphi for Python - Part 1:   Del...
Introduction to Python GUI development with Delphi for Python - Part 1: Del...
 
FMXLinux Introduction - Delphi's FireMonkey for Linux
FMXLinux Introduction - Delphi's FireMonkey for LinuxFMXLinux Introduction - Delphi's FireMonkey for Linux
FMXLinux Introduction - Delphi's FireMonkey for Linux
 
Python for Delphi Developers - Part 2
Python for Delphi Developers - Part 2Python for Delphi Developers - Part 2
Python for Delphi Developers - Part 2
 
Python for Delphi Developers - Part 1 Introduction
Python for Delphi Developers - Part 1 IntroductionPython for Delphi Developers - Part 1 Introduction
Python for Delphi Developers - Part 1 Introduction
 
RAD Industrial Automation, Labs, and Instrumentation
RAD Industrial Automation, Labs, and InstrumentationRAD Industrial Automation, Labs, and Instrumentation
RAD Industrial Automation, Labs, and Instrumentation
 
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBase
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBaseEmbeddable Databases for Mobile Apps: Stress-Free Solutions with InterBase
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBase
 
Rad Server Industry Template - Connected Nurses Station - Setup Document
Rad Server Industry Template - Connected Nurses Station - Setup DocumentRad Server Industry Template - Connected Nurses Station - Setup Document
Rad Server Industry Template - Connected Nurses Station - Setup Document
 
TMS Google Mapping Components
TMS Google Mapping ComponentsTMS Google Mapping Components
TMS Google Mapping Components
 
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinar
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinarMove Desktop Apps to the Cloud - RollApp & Embarcadero webinar
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinar
 
Useful C++ Features You Should be Using
Useful C++ Features You Should be UsingUseful C++ Features You Should be Using
Useful C++ Features You Should be Using
 
Getting Started Building Mobile Applications for iOS and Android
Getting Started Building Mobile Applications for iOS and AndroidGetting Started Building Mobile Applications for iOS and Android
Getting Started Building Mobile Applications for iOS and Android
 
Embarcadero RAD server Launch Webinar
Embarcadero RAD server Launch WebinarEmbarcadero RAD server Launch Webinar
Embarcadero RAD server Launch Webinar
 
ER/Studio 2016: Build a Business-Driven Data Architecture
ER/Studio 2016: Build a Business-Driven Data ArchitectureER/Studio 2016: Build a Business-Driven Data Architecture
ER/Studio 2016: Build a Business-Driven Data Architecture
 
The Secrets of SQL Server: Database Worst Practices
The Secrets of SQL Server: Database Worst PracticesThe Secrets of SQL Server: Database Worst Practices
The Secrets of SQL Server: Database Worst Practices
 
Driving Business Value Through Agile Data Assets
Driving Business Value Through Agile Data AssetsDriving Business Value Through Agile Data Assets
Driving Business Value Through Agile Data Assets
 
Troubleshooting Plan Changes with Query Store in SQL Server 2016
Troubleshooting Plan Changes with Query Store in SQL Server 2016Troubleshooting Plan Changes with Query Store in SQL Server 2016
Troubleshooting Plan Changes with Query Store in SQL Server 2016
 

Último

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Último (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

New Tools for Faster SQL Tuning and Analysis

  • 1. Tech Notes New Tools for Faster SQL Tuning and Analysis Embarcadero Technologies November 2009 Corporate Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California Street, 12th Floor York House L7. 313 La Trobe Street San Francisco, California 94111 18 York Road Melbourne VIC 3000 Maidenhead, Berkshire Australia SL6 1SF, United Kingdom
  • 2. New Tools for Faster SQL Tuning and Analysis INTRODUCTION SQL tuning is complicated. The growing size and complexity of databases, innovations in application development tools that automatically generate SQL code that is often inefficient, and built in database optimizers that vary in their ability to pick the optimum execution path are all common challenges within the realm of performance optimization. Adding to the complexity, pressures to reduce hardware spending while meeting strict SLA and other performance requirements are constantly pushing the limits of SQL profiling and tuning tools as well as the expertise of the DBA. And now there is a growing trend to arm the developers themselves with SQL optimization tools and integrate SQL tuning into the development lifecycle. To achieve the best results under these circumstances, organizations should standardize on one tool that serves the needs of the developer as well as the more advanced SQL tuning techniques required by the DBA. Traditionally, DBAs use hint injections and SQL rewrites, but now there are new innovations in SQL tuning like index analysis and, most recently, Visual SQL Tuning (VST). These new innovations serve two masters; they reduce the complexity of SQL tuning for the developer, while providing more detailed and advanced analysis for the DBA. TRADITIONAL SQL TUNING When you execute SQL on a particular database, the database uses its own internal optimizer to determine the quickest execution path for that SQL, based on the way it is written, and a ‘cost’ is reflected in the resultant explain plan. Because the database vendors are continually improving the performance of their respective optimizers, the database optimizer generally picks the optimum path. There are, however, always cases where the optimizer needs to be forced down a faster execution path in order to ensure the best possible performance. This method is delivered through a hint that is injected into the SQL to direct the optimizer as the SQL is executed. Rather than injecting hints for the optimizer to follow, some DBAs prefer to rewrite the SQL to accelerate the query. Examples of common SQL coding mistakes that can be repaired by SQL rewrites include Cartesian join elimination, expression transformation, invalid outer join, transitivity, and push sub-query to name a few. The one thing to be wary of with some SQL rewrites is that the result set of the query could be affected, so it’s important to take this into account when leveraging rewrites. Embarcadero® DB Optimizer™ provides both hint injections and SQL rewrites for the DBA or developer to use as they wish. The DB Optimizer tuning feature automatically examines an SQL statement and suggests applicable hints as well as SQL rewrites in parallel, highlighting the SQL rewrite options to ensure you are aware that the result set may be altered (i.e. missing a valid join criteria). Embarcadero Technologies -1-
  • 3. New Tools for Faster SQL Tuning and Analysis Figure 1: DB Optimizer offers both hint injection and SQL rewrites INNOVATIONS IN SQL TUNING – INDEX ANALYSIS AND VISUAL SQL TUNING Most SQL tuning tools stop at hint injection and SQL rewrites, but DB Optimizer takes analysis and tuning a step beyond with advances in index analysis and unparalleled innovation with Visual SQL Tuning (VST) diagrams. Index Analysis empowers DBAs and developers to fully examine SQL execution paths to better understand which indexes are used, not used, or missing. And if an index is missing, DB Optimizer offers indexing recommendations for optimum performance. The VST diagram displays indexes and constraints on tables and views, as well as the joins used in a SQL statement. This innovative visual format quickly reveals opportunities to tune the SQL or schema and enhance overall database performance. Embarcadero Technologies -2-
  • 4. New Tools for Faster SQL Tuning and Analysis Figure 2: SQL Analysis tab displays Visual SQL Tuning diagrams and index analysis   ADVANCED INDEX ANALYSIS Given a particular SQL statement and its variables (i.e., tables and columns used, join and filter criteria, ordering in the ‘where clause’, etc.), the database-specific optimizer returns an explain plan that charts the step-by-step execution path through the database, including the indexes leveraged along the way. DB Optimizer takes this information as well as information about existing indexes and charts them in four different ways: indexes that are being used (green); indexes that exist but are not used by the database-specific optimizer (blue); indexes that exist on the table but are not leveraged based on the existing ‘where clause’ (grey); and indexes that do not exist but are suggested by DB Optimizer (orange). Figure 3: Color-coded index analysis Embarcadero Technologies -3-
  • 5. New Tools for Faster SQL Tuning and Analysis In the case where the index does not exist, DB Optimizer allows you to generate the recommended index at the click of a button. It is also very useful to understand when an index is not being used. A developer might write an index in an attempt to speed up the query, but then learn the optimizer is not using it for that query. This information gives the developer the opportunity to rewrite the index to try to get the optimizer to use it or decide to remove the index entirely if it is superfluous. VISUAL SQL TUNING (VST) DIAGRAMS Delivering a new level of innovation in SQL tuning, DB Optimizer can parse an SQL query and analyze the indexes and constraints on the tables and views in the query and display the query in graphical format. The resultant VST diagram, which can be displayed in either Summary Mode or Detail Mode, helps developers and DBAs see flaws in the schema design such as Cartesian joins, implied Cartesian joins, and many-to-many relationships. The VST diagram helps you quickly understand the components of an SQL query, thus accelerating trouble- shooting and analysis. This is a very useful feature for the DBA to initiate informed design conversations with Data Architects for cross-organizational collaboration. Figure 4: Visual SQL Tuning diagram provides at-a-glance information about query or schema design – in this case a Cartesian join In the case above, where a Cartesian join is discovered, DB Optimizer resolves the performance issue based on the results of analysis and rewrites the query. CONCLUSION - BEST PRACTICES IN SQL TUNING When faced with a number of options, it is always a good idea to take a step back and look at your existing workflow and insert best practices in each step of the process. The best way to identify database bottlenecks caused by SQL is to start with a profiling session. Once DB Optimizer has filtered out the worst-performing SQL code, you can import that SQL code Embarcadero Technologies -4-
  • 6. New Tools for Faster SQL Tuning and Analysis directly into the tuner and into the Input Tab. The Overview Tab displays case generation using the SQL rewrites and hint injections. DB Optimizer’s Load Editor, a SQL stress testing feature, lets you simulate parallel sessions and number of executions to measure any performance gains side-by-side with pre-tuned and tuned SQL while profiling the database. When classic tuning methods will not suffice or service levels are still out of reach after retesting, the Analysis Tab reveals opportunities for advanced tuning methods. Figure 5: DB Optimizer Analysis Tab offers both developers and DBAs the tool they need to satisfy their respective SQL optimization needs. Embarcadero Technologies -5-
  • 7. Embarcadero Technologies, Inc. is a leading provider of award-winning tools for application developers and database professionals so they can design systems right, build them faster and run them better, regardless of their platform or programming language. Ninety of the Fortune 100 and an active community of more than three million users worldwide rely on Embarcadero products to increase productivity, reduce costs, simplify change management and compliance and accelerate innovation. The company’s flagship tools include: Embarcadero® Change Manager™, Embarcadero® RAD Studio, DBArtisan®, Delphi®, ER/Studio®, JBuilder® and Rapid SQL®. Founded in 1993, Embarcadero is headquartered in San Francisco, with offices located around the world. Embarcadero is online at www.embarcadero.com.