SlideShare a Scribd company logo
DATABASE 
OPTIMIZATION 
_by Oleksii Prohonnyi
The degree of normality 
in a database 
is inversely proportional to that 
of its DBA.
WHEN DO WE OPTIMIZE 
THE DATABASE?
You should get your home page 
down to 1.5 seconds. 
(Google’s threshold for being 
considered a “fast” website) 
Best Practices for Speeding Up Your Web Site by Yahoo
PROFILE FIRST, 
OPTIMIZE LAST
The basic rule of optimization is to 
never assume - always verify, 
using actual data.
PEAR_Benchmark 
Stores microtime() values before and after 
the query for later observation, and the 
difference would be the timing of the query 
with good accuracy. 
Package Information: Benchmark by The PHP Group
PEAR_Benchmark 
Example 1: Automatic profiling start, stop, 
and output.
PEAR_Benchmark 
Example 2: Manual profiling start, stop, 
and output.
Zend_Db_Profiler 
Built-in support for profiling in Zend 
Framework.
CWebLogRoute 
Built-in support for profiling in Yii 
Framework.
It's very important to profile using 
a relevant dataset. 
You should create a test machine that 
resembles your live dataset as much as 
possible to get relevant data.
Another important note is to avoid 
looking at cached results. 
- SQL_NO_CACHE 
- MySQL Caches 
- OS Caches 
- Hardware Caches 
Query Profiling with MySQL: Bypassing caches by Peter Zaitsev
The Slow Query Log 
Profiles queries that are used by daemons 
and cron jobs and log the results to a file. 
5.2.5. The Slow Query Log by Oracle Corporation
OPTIMIZING 
PERFORMANCE
There are 4 basic ways to optimize 
query performance: 
- Rewrite the queries 
- Change indexing strategy 
- Change schema 
- Use an external cache
EXAMINING QUERY 
EXECUTION PLANS
EXPLAIN 
Add the reserved word 'EXPLAIN' at the 
beginning of your query to get the execution 
plan for the query. 
8.2.2. EXPLAIN Output Format by Oracle Corporation
EXPLAIN limitations: 
- EXPLAIN can be wrong 
- EXPLAIN works for SELECT only 
- EXPLAIN may take long time 
- Estimated number of rows may be very 
inaccurate 
…. 
MySQL EXPLAIN limits and errors by Peter Zaitsev
COMMON 
OPTIMIZATIONS
1. Looping queries 
One of the most common mistakes is to 
query in a loop without need. 
Most likely looped SELECT queries can be 
rewritten as a JOIN.
2. Picking only needed columns 
Picking only the needed columns is a good 
general practice to use, and avoids those 
problems.
3. Filtering rows correctly and 
using indexes 
Our main goal is to select the smallest 
amount of rows we need and doing so in 
the fastest way possible.
Filtering rows correctly and 
using indexes 
Example - fetching users created in the 
last 4 weeks.
Filtering rows correctly and 
using indexes 
Example - select the lowest priced fruit from 
several fruit types.
4. Indexing correctly 
Using more indexes than is necessary can 
have adverse affects - as it slows down 
the operation of INSERT and UPDATE 
queries, while taking up more memory. 
Do you always need index on WHERE column? by Vadim Tkachenko
5. Picking the right engine 
for your data 
MySQL has a pluggable engine design, 
which allows you to use different engine 
types to store your data, each with its own 
advantages and drawbacks. 
Chapter 14. Storage Engines by Oracle Corporation
CACHING
There are many caching strategies. 
Common options include caching to disk 
(files) or caching to memory (using solutions 
such as memcache or APC). 
Another form of caching is to the database – 
by de-normalizing the schema to store data 
that is the result of expensive to run queries.
S4I8GMA UKRAINE
Oleksii Prohonnyi 
facebook.com/oprohonnyi 
linkedin.com/in/oprohonnyi

More Related Content

Viewers also liked

Caso de Sucesso WK - Akira - Distribuidora de Cartões Telefônicos
Caso de Sucesso WK - Akira - Distribuidora de Cartões TelefônicosCaso de Sucesso WK - Akira - Distribuidora de Cartões Telefônicos
Caso de Sucesso WK - Akira - Distribuidora de Cartões Telefônicos
WK Sistemas
 
Poster - Personal Competencies Model
Poster - Personal Competencies ModelPoster - Personal Competencies Model
Poster - Personal Competencies Model
Gail Matthews-DeNatale
 
curriculum vitae(Nilesh Thummar)
curriculum vitae(Nilesh Thummar)curriculum vitae(Nilesh Thummar)
curriculum vitae(Nilesh Thummar)Nilesh Thummar
 
HR2020 Mediawijs - Jos Koppelaar
HR2020 Mediawijs - Jos KoppelaarHR2020 Mediawijs - Jos Koppelaar
HR2020 Mediawijs - Jos Koppelaar
HR2020
 
Desbarajuste farmacológico. amf
Desbarajuste farmacológico. amfDesbarajuste farmacológico. amf
Desbarajuste farmacológico. amfjavithink
 
Tswportfolio images
Tswportfolio imagesTswportfolio images
Tswportfolio images
Talia Witherspoon
 
Thinking styles in the quran
Thinking styles in the quranThinking styles in the quran
Thinking styles in the quran
Belayet Hossen
 
Leptospirosis- Dr Ajay Tyagi
Leptospirosis- Dr Ajay TyagiLeptospirosis- Dr Ajay Tyagi
Leptospirosis- Dr Ajay Tyagi
Drajay Tyagi
 

Viewers also liked (11)

Mentor 2015 Certificate
Mentor 2015 CertificateMentor 2015 Certificate
Mentor 2015 Certificate
 
Facilitation
FacilitationFacilitation
Facilitation
 
Caso de Sucesso WK - Akira - Distribuidora de Cartões Telefônicos
Caso de Sucesso WK - Akira - Distribuidora de Cartões TelefônicosCaso de Sucesso WK - Akira - Distribuidora de Cartões Telefônicos
Caso de Sucesso WK - Akira - Distribuidora de Cartões Telefônicos
 
Poster - Personal Competencies Model
Poster - Personal Competencies ModelPoster - Personal Competencies Model
Poster - Personal Competencies Model
 
Resume (2)
Resume (2)Resume (2)
Resume (2)
 
curriculum vitae(Nilesh Thummar)
curriculum vitae(Nilesh Thummar)curriculum vitae(Nilesh Thummar)
curriculum vitae(Nilesh Thummar)
 
HR2020 Mediawijs - Jos Koppelaar
HR2020 Mediawijs - Jos KoppelaarHR2020 Mediawijs - Jos Koppelaar
HR2020 Mediawijs - Jos Koppelaar
 
Desbarajuste farmacológico. amf
Desbarajuste farmacológico. amfDesbarajuste farmacológico. amf
Desbarajuste farmacológico. amf
 
Tswportfolio images
Tswportfolio imagesTswportfolio images
Tswportfolio images
 
Thinking styles in the quran
Thinking styles in the quranThinking styles in the quran
Thinking styles in the quran
 
Leptospirosis- Dr Ajay Tyagi
Leptospirosis- Dr Ajay TyagiLeptospirosis- Dr Ajay Tyagi
Leptospirosis- Dr Ajay Tyagi
 

Similar to Database Optimization (MySQL)

Quick And Easy Guide To Speeding Up MySQL for web developers
Quick And Easy Guide To Speeding Up MySQL for web developersQuick And Easy Guide To Speeding Up MySQL for web developers
Quick And Easy Guide To Speeding Up MySQL for web developers
Jonathan Levin
 
High Performance Mysql
High Performance MysqlHigh Performance Mysql
High Performance Mysql
liufabin 66688
 
Data mining and warehousing (uca15 e04)
Data mining and warehousing (uca15 e04)Data mining and warehousing (uca15 e04)
Data mining and warehousing (uca15 e04)
Ponveni Karunakaran
 
scale_perf_best_practices
scale_perf_best_practicesscale_perf_best_practices
scale_perf_best_practiceswebuploader
 
iLeap- Test Automation Framework- Impetus White Paper
iLeap- Test Automation Framework- Impetus White PaperiLeap- Test Automation Framework- Impetus White Paper
iLeap- Test Automation Framework- Impetus White Paper
Impetus Technologies
 
Why Automation is Required in Software Testing - OSSCamp 2014
Why Automation is Required in Software Testing - OSSCamp 2014Why Automation is Required in Software Testing - OSSCamp 2014
Why Automation is Required in Software Testing - OSSCamp 2014OSSCube
 
Java Tuning White Paper
Java Tuning White PaperJava Tuning White Paper
Java Tuning White Paperwhite paper
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
Ryusuke Kajiyama
 
Data Driven Framework in Selenium
Data Driven Framework in SeleniumData Driven Framework in Selenium
Data Driven Framework in Selenium
Knoldus Inc.
 
Key to a successful Exadata POC
Key to a successful Exadata POCKey to a successful Exadata POC
Key to a successful Exadata POC
Umair Mansoob
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
Philip Norton
 
4 facing explosive data growth five ways to optimize storage for oracle datab...
4 facing explosive data growth five ways to optimize storage for oracle datab...4 facing explosive data growth five ways to optimize storage for oracle datab...
4 facing explosive data growth five ways to optimize storage for oracle datab...Dr. Wilfred Lin (Ph.D.)
 
Using Compass to Diagnose Performance Problems
Using Compass to Diagnose Performance Problems Using Compass to Diagnose Performance Problems
Using Compass to Diagnose Performance Problems
MongoDB
 
Using Compass to Diagnose Performance Problems in Your Cluster
Using Compass to Diagnose Performance Problems in Your ClusterUsing Compass to Diagnose Performance Problems in Your Cluster
Using Compass to Diagnose Performance Problems in Your Cluster
MongoDB
 
WEBINAR: To Automate or Not to Automate
WEBINAR: To Automate or Not to AutomateWEBINAR: To Automate or Not to Automate
WEBINAR: To Automate or Not to Automate
Rainforest QA
 
To Automate or Not to Automate
To Automate or Not to Automate To Automate or Not to Automate
To Automate or Not to Automate
Stephanie Abe
 
2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire
Marko Mitranić
 
Performance tuning intro
Performance tuning introPerformance tuning intro
Performance tuning intro
aioughydchapter
 
Performance Optimization
Performance OptimizationPerformance Optimization
Performance OptimizationNeha Thakur
 

Similar to Database Optimization (MySQL) (20)

Quick And Easy Guide To Speeding Up MySQL for web developers
Quick And Easy Guide To Speeding Up MySQL for web developersQuick And Easy Guide To Speeding Up MySQL for web developers
Quick And Easy Guide To Speeding Up MySQL for web developers
 
High Performance Mysql
High Performance MysqlHigh Performance Mysql
High Performance Mysql
 
Data mining and warehousing (uca15 e04)
Data mining and warehousing (uca15 e04)Data mining and warehousing (uca15 e04)
Data mining and warehousing (uca15 e04)
 
sample1
sample1sample1
sample1
 
scale_perf_best_practices
scale_perf_best_practicesscale_perf_best_practices
scale_perf_best_practices
 
iLeap- Test Automation Framework- Impetus White Paper
iLeap- Test Automation Framework- Impetus White PaperiLeap- Test Automation Framework- Impetus White Paper
iLeap- Test Automation Framework- Impetus White Paper
 
Why Automation is Required in Software Testing - OSSCamp 2014
Why Automation is Required in Software Testing - OSSCamp 2014Why Automation is Required in Software Testing - OSSCamp 2014
Why Automation is Required in Software Testing - OSSCamp 2014
 
Java Tuning White Paper
Java Tuning White PaperJava Tuning White Paper
Java Tuning White Paper
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
 
Data Driven Framework in Selenium
Data Driven Framework in SeleniumData Driven Framework in Selenium
Data Driven Framework in Selenium
 
Key to a successful Exadata POC
Key to a successful Exadata POCKey to a successful Exadata POC
Key to a successful Exadata POC
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
 
4 facing explosive data growth five ways to optimize storage for oracle datab...
4 facing explosive data growth five ways to optimize storage for oracle datab...4 facing explosive data growth five ways to optimize storage for oracle datab...
4 facing explosive data growth five ways to optimize storage for oracle datab...
 
Using Compass to Diagnose Performance Problems
Using Compass to Diagnose Performance Problems Using Compass to Diagnose Performance Problems
Using Compass to Diagnose Performance Problems
 
Using Compass to Diagnose Performance Problems in Your Cluster
Using Compass to Diagnose Performance Problems in Your ClusterUsing Compass to Diagnose Performance Problems in Your Cluster
Using Compass to Diagnose Performance Problems in Your Cluster
 
WEBINAR: To Automate or Not to Automate
WEBINAR: To Automate or Not to AutomateWEBINAR: To Automate or Not to Automate
WEBINAR: To Automate or Not to Automate
 
To Automate or Not to Automate
To Automate or Not to Automate To Automate or Not to Automate
To Automate or Not to Automate
 
2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire
 
Performance tuning intro
Performance tuning introPerformance tuning intro
Performance tuning intro
 
Performance Optimization
Performance OptimizationPerformance Optimization
Performance Optimization
 

More from Oleksii Prohonnyi

Utility libraries to make your life easier
Utility libraries to make your life easierUtility libraries to make your life easier
Utility libraries to make your life easier
Oleksii Prohonnyi
 
Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
 
Dive into Angular, part 5: Experience
Dive into Angular, part 5: ExperienceDive into Angular, part 5: Experience
Dive into Angular, part 5: Experience
Oleksii Prohonnyi
 
Dive into Angular, part 3: Performance
Dive into Angular, part 3: PerformanceDive into Angular, part 3: Performance
Dive into Angular, part 3: Performance
Oleksii Prohonnyi
 
Dive into Angular, part 2: Architecture
Dive into Angular, part 2: ArchitectureDive into Angular, part 2: Architecture
Dive into Angular, part 2: Architecture
Oleksii Prohonnyi
 
Dive into Angular, part 1: Introduction
Dive into Angular, part 1: IntroductionDive into Angular, part 1: Introduction
Dive into Angular, part 1: Introduction
Oleksii Prohonnyi
 
Cycle.js overview
Cycle.js overviewCycle.js overview
Cycle.js overview
Oleksii Prohonnyi
 
Moment.js overview
Moment.js overviewMoment.js overview
Moment.js overview
Oleksii Prohonnyi
 
Bower introduction
Bower introductionBower introduction
Bower introduction
Oleksii Prohonnyi
 
JavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and LibrariesJavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and Libraries
Oleksii Prohonnyi
 
Introduction to D3.js
Introduction to D3.jsIntroduction to D3.js
Introduction to D3.js
Oleksii Prohonnyi
 
Conference DotJS 2015 Paris review
Conference DotJS 2015 Paris reviewConference DotJS 2015 Paris review
Conference DotJS 2015 Paris review
Oleksii Prohonnyi
 
Asm.js introduction
Asm.js introductionAsm.js introduction
Asm.js introduction
Oleksii Prohonnyi
 
Code review process with JetBrains UpSource
Code review process with JetBrains UpSourceCode review process with JetBrains UpSource
Code review process with JetBrains UpSource
Oleksii Prohonnyi
 
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
Oleksii Prohonnyi
 
OpenLayer's basics
OpenLayer's basicsOpenLayer's basics
OpenLayer's basics
Oleksii Prohonnyi
 
Front-end rich JavaScript application creation (Backbone.js)
Front-end rich JavaScript application creation (Backbone.js)Front-end rich JavaScript application creation (Backbone.js)
Front-end rich JavaScript application creation (Backbone.js)
Oleksii Prohonnyi
 
Как создать сайт за 2 часа? (Wordpress)
Как создать сайт за 2 часа? (Wordpress)Как создать сайт за 2 часа? (Wordpress)
Как создать сайт за 2 часа? (Wordpress)
Oleksii Prohonnyi
 
Разработка веб-сайта. Сайт. Зачем он?
Разработка веб-сайта. Сайт. Зачем он?Разработка веб-сайта. Сайт. Зачем он?
Разработка веб-сайта. Сайт. Зачем он?
Oleksii Prohonnyi
 
Google Chrome DevTools features overview
Google Chrome DevTools features overviewGoogle Chrome DevTools features overview
Google Chrome DevTools features overview
Oleksii Prohonnyi
 

More from Oleksii Prohonnyi (20)

Utility libraries to make your life easier
Utility libraries to make your life easierUtility libraries to make your life easier
Utility libraries to make your life easier
 
Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0
 
Dive into Angular, part 5: Experience
Dive into Angular, part 5: ExperienceDive into Angular, part 5: Experience
Dive into Angular, part 5: Experience
 
Dive into Angular, part 3: Performance
Dive into Angular, part 3: PerformanceDive into Angular, part 3: Performance
Dive into Angular, part 3: Performance
 
Dive into Angular, part 2: Architecture
Dive into Angular, part 2: ArchitectureDive into Angular, part 2: Architecture
Dive into Angular, part 2: Architecture
 
Dive into Angular, part 1: Introduction
Dive into Angular, part 1: IntroductionDive into Angular, part 1: Introduction
Dive into Angular, part 1: Introduction
 
Cycle.js overview
Cycle.js overviewCycle.js overview
Cycle.js overview
 
Moment.js overview
Moment.js overviewMoment.js overview
Moment.js overview
 
Bower introduction
Bower introductionBower introduction
Bower introduction
 
JavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and LibrariesJavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and Libraries
 
Introduction to D3.js
Introduction to D3.jsIntroduction to D3.js
Introduction to D3.js
 
Conference DotJS 2015 Paris review
Conference DotJS 2015 Paris reviewConference DotJS 2015 Paris review
Conference DotJS 2015 Paris review
 
Asm.js introduction
Asm.js introductionAsm.js introduction
Asm.js introduction
 
Code review process with JetBrains UpSource
Code review process with JetBrains UpSourceCode review process with JetBrains UpSource
Code review process with JetBrains UpSource
 
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
 
OpenLayer's basics
OpenLayer's basicsOpenLayer's basics
OpenLayer's basics
 
Front-end rich JavaScript application creation (Backbone.js)
Front-end rich JavaScript application creation (Backbone.js)Front-end rich JavaScript application creation (Backbone.js)
Front-end rich JavaScript application creation (Backbone.js)
 
Как создать сайт за 2 часа? (Wordpress)
Как создать сайт за 2 часа? (Wordpress)Как создать сайт за 2 часа? (Wordpress)
Как создать сайт за 2 часа? (Wordpress)
 
Разработка веб-сайта. Сайт. Зачем он?
Разработка веб-сайта. Сайт. Зачем он?Разработка веб-сайта. Сайт. Зачем он?
Разработка веб-сайта. Сайт. Зачем он?
 
Google Chrome DevTools features overview
Google Chrome DevTools features overviewGoogle Chrome DevTools features overview
Google Chrome DevTools features overview
 

Recently uploaded

Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
Sharepoint Designs
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 

Recently uploaded (20)

Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 

Database Optimization (MySQL)

  • 1. DATABASE OPTIMIZATION _by Oleksii Prohonnyi
  • 2. The degree of normality in a database is inversely proportional to that of its DBA.
  • 3.
  • 4. WHEN DO WE OPTIMIZE THE DATABASE?
  • 5.
  • 6. You should get your home page down to 1.5 seconds. (Google’s threshold for being considered a “fast” website) Best Practices for Speeding Up Your Web Site by Yahoo
  • 8.
  • 9. The basic rule of optimization is to never assume - always verify, using actual data.
  • 10. PEAR_Benchmark Stores microtime() values before and after the query for later observation, and the difference would be the timing of the query with good accuracy. Package Information: Benchmark by The PHP Group
  • 11. PEAR_Benchmark Example 1: Automatic profiling start, stop, and output.
  • 12.
  • 13. PEAR_Benchmark Example 2: Manual profiling start, stop, and output.
  • 14.
  • 15. Zend_Db_Profiler Built-in support for profiling in Zend Framework.
  • 16.
  • 17. CWebLogRoute Built-in support for profiling in Yii Framework.
  • 18.
  • 19.
  • 20.
  • 21. It's very important to profile using a relevant dataset. You should create a test machine that resembles your live dataset as much as possible to get relevant data.
  • 22. Another important note is to avoid looking at cached results. - SQL_NO_CACHE - MySQL Caches - OS Caches - Hardware Caches Query Profiling with MySQL: Bypassing caches by Peter Zaitsev
  • 23. The Slow Query Log Profiles queries that are used by daemons and cron jobs and log the results to a file. 5.2.5. The Slow Query Log by Oracle Corporation
  • 25.
  • 26. There are 4 basic ways to optimize query performance: - Rewrite the queries - Change indexing strategy - Change schema - Use an external cache
  • 28. EXPLAIN Add the reserved word 'EXPLAIN' at the beginning of your query to get the execution plan for the query. 8.2.2. EXPLAIN Output Format by Oracle Corporation
  • 29.
  • 30.
  • 31. EXPLAIN limitations: - EXPLAIN can be wrong - EXPLAIN works for SELECT only - EXPLAIN may take long time - Estimated number of rows may be very inaccurate …. MySQL EXPLAIN limits and errors by Peter Zaitsev
  • 33.
  • 34. 1. Looping queries One of the most common mistakes is to query in a loop without need. Most likely looped SELECT queries can be rewritten as a JOIN.
  • 35.
  • 36. 2. Picking only needed columns Picking only the needed columns is a good general practice to use, and avoids those problems.
  • 37.
  • 38. 3. Filtering rows correctly and using indexes Our main goal is to select the smallest amount of rows we need and doing so in the fastest way possible.
  • 39. Filtering rows correctly and using indexes Example - fetching users created in the last 4 weeks.
  • 40.
  • 41. Filtering rows correctly and using indexes Example - select the lowest priced fruit from several fruit types.
  • 42.
  • 43. 4. Indexing correctly Using more indexes than is necessary can have adverse affects - as it slows down the operation of INSERT and UPDATE queries, while taking up more memory. Do you always need index on WHERE column? by Vadim Tkachenko
  • 44. 5. Picking the right engine for your data MySQL has a pluggable engine design, which allows you to use different engine types to store your data, each with its own advantages and drawbacks. Chapter 14. Storage Engines by Oracle Corporation
  • 45.
  • 47. There are many caching strategies. Common options include caching to disk (files) or caching to memory (using solutions such as memcache or APC). Another form of caching is to the database – by de-normalizing the schema to store data that is the result of expensive to run queries.
  • 49. Oleksii Prohonnyi facebook.com/oprohonnyi linkedin.com/in/oprohonnyi