SlideShare a Scribd company logo
1 of 20
MySQL Optimization
                     Tips to increase performance




Sachin Khosla
Founder, Digimantra.com
What’s next ?
 MySQL – What’s that ?
 Optimize ? Where and What ?
 Quick Glance at the famous MySQL Storage Engines
 Many ways but we talk about Cache systems
     Query Cache
     File Cache
     MemCached
     Solr/Lucene
Let’s Go !

Have a question ?

   • If it’s a short – Shoot it ?
   • If it’s a long – Save it till end of the session :)
As many of you know !
•MySQL is a relational database
•Community Edition is free of cost
•Free GUI tools for Server Administration
•Support by the community, forums, manual/docs etc.
Why Optimize
• Cost
    • Tuned system = less resources = less investment.
    • After tuning the system, you get a real usage stat.

• Performance
     • Performance of the system increases the output :)
     • Happy developers = Happy end users

• Stay in the game
     • Undoubtedly you want to keep pace with the latest technology
     • Faster systems showcase helps bring in more business
Who Should Optimize?
Ecosystem – Who are responsible in developing that very application.

    1.   Designers – The documenting guys :)
    2.   Developers – Geeks :D
    3.   System/DB Administrators – The machines :P
Optimized, Really ?

• Benchmarking
• Profiling
• Difference between the Benchmark & Profiling


Ref - http://dev.mysql.com/tech-resources/articles/pro-mysql-ch6.html
MySQL flavors

•MyISAM – The ideal son
•InnoDB – Clever but expensive*
•Memory (Heap)
MyISAM                          InnoDB
•Of course, there is no        •Of course, there is no
difference. It’s just you !    difference. It’s just you !
•You need speed and term       •You understand, what
“transaction” is martian for   transactions are and how are
you.                           they going to effect.
•You sure about the size of    •Sky is the limit – did you
the data in your database.     smell cloud computing,eh?
•Data is stored in insertion   •Rows are physically ordered
order. (no clustered index)    by the primary key
Memory (Heap)
• Faster, Performance booster
• Intermediary table
• Use it when you have more select than insert
• Table Structure remains not the data
• Fixed length for data types like varchar
• No support for text, blob
Finally, ways to boost performance
• Mysql Query Cache
• File Cache system
• Memcached
• Solr / Lucene
Mysql Query Cache
• Internal cache system of MySQL
• Caches the queries being fired
• Never returns stale data
• Good when you have less or almost no inserts
• Be sure to choose an optimum size for cache
   (query_cache_size)
File Cache system

• Traditional way of caching with files.
• Saves database server ping.
• Still accesses the file structure.
• No Big Deal !
Memcached
• How is it different than traditional cache ?
• Can it improve my site’s application’s performance ?
• How ?
          $mem = new Memcache(); //PECL extn in PHP
          $mem->connect(‘SERVER_NAME’,’PORT_NO’); //connect
          $mem->set(‘key’,’data’);   //set memcached KV pair
          $mem->get(‘key’);          //get data
Solr / Lucene
•Hit highlighting, faceted search, caching, replication,
and a web administration interface – Heavy terms ?

•In simple terms it’s a server which has indexes of the
database and when you send a request to it, it return
you data in the form of XML/JSON
Other ways
• Query Optimization
    • Using Explain
    • Show table status (InnoDB / MySQL)
    • Show InnoDB status (indexes and all )
•Table level Optimization
    • Normalization
• DB Server Level
    • mysqld status
    • Process monitoring tools
Q&A
Thank you !



    www.digimantra.com
      Twitter - @realin
FB – http://fb.me/sachinkhosla

More Related Content

What's hot

Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on ZarafaZarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010
Barry Abrahamson
 
Moving to the Cloud: AWS, Zend, RightScale
Moving to the Cloud: AWS, Zend, RightScaleMoving to the Cloud: AWS, Zend, RightScale
Moving to the Cloud: AWS, Zend, RightScale
mmoline
 
SQLDay2013_DennyCherry_GettingSQLServiceBrokerUp&Running
SQLDay2013_DennyCherry_GettingSQLServiceBrokerUp&RunningSQLDay2013_DennyCherry_GettingSQLServiceBrokerUp&Running
SQLDay2013_DennyCherry_GettingSQLServiceBrokerUp&Running
Polish SQL Server User Group
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
Mike Willbanks
 

What's hot (20)

High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
 
Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on ZarafaZarafa SummerCamp 2012 - Exchange Web Services on Zarafa
Zarafa SummerCamp 2012 - Exchange Web Services on Zarafa
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010
 
SPCA2013 - Automating SharePoint
SPCA2013 - Automating SharePointSPCA2013 - Automating SharePoint
SPCA2013 - Automating SharePoint
 
Building low latency java applications with ehcache
Building low latency java applications with ehcacheBuilding low latency java applications with ehcache
Building low latency java applications with ehcache
 
Multi-tenant Database Design for SaaS
Multi-tenant Database Design for SaaSMulti-tenant Database Design for SaaS
Multi-tenant Database Design for SaaS
 
SPCA2013 - Taming BIG SharePoint
SPCA2013 - Taming BIG SharePointSPCA2013 - Taming BIG SharePoint
SPCA2013 - Taming BIG SharePoint
 
Microsoft Azure SQL Premium
Microsoft Azure SQL PremiumMicrosoft Azure SQL Premium
Microsoft Azure SQL Premium
 
Adobe CQ5 for Developers - Introduction
Adobe CQ5 for Developers - IntroductionAdobe CQ5 for Developers - Introduction
Adobe CQ5 for Developers - Introduction
 
itPage LDC 09 Presentation
itPage LDC 09 PresentationitPage LDC 09 Presentation
itPage LDC 09 Presentation
 
Introduction to maya
Introduction to mayaIntroduction to maya
Introduction to maya
 
Moving to the Cloud: AWS, Zend, RightScale
Moving to the Cloud: AWS, Zend, RightScaleMoving to the Cloud: AWS, Zend, RightScale
Moving to the Cloud: AWS, Zend, RightScale
 
Project First presentation about introduction to technologies to be used
Project First presentation about introduction to technologies to be usedProject First presentation about introduction to technologies to be used
Project First presentation about introduction to technologies to be used
 
Expert guide for PHP
Expert guide for PHPExpert guide for PHP
Expert guide for PHP
 
SQLDay2013_DennyCherry_GettingSQLServiceBrokerUp&Running
SQLDay2013_DennyCherry_GettingSQLServiceBrokerUp&RunningSQLDay2013_DennyCherry_GettingSQLServiceBrokerUp&Running
SQLDay2013_DennyCherry_GettingSQLServiceBrokerUp&Running
 
Learn css step by step online course
Learn css step by step online course Learn css step by step online course
Learn css step by step online course
 
Memcache
MemcacheMemcache
Memcache
 
Sql Server Service Broker In The Real World
Sql Server Service Broker In The Real WorldSql Server Service Broker In The Real World
Sql Server Service Broker In The Real World
 
SQL Azure
SQL AzureSQL Azure
SQL Azure
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
 

Similar to MySQL Optimization from a Developer's point of view

Storage Systems For Scalable systems
Storage Systems For Scalable systemsStorage Systems For Scalable systems
Storage Systems For Scalable systems
elliando dias
 
Meta scale kognitio hadoop webinar
Meta scale kognitio hadoop webinarMeta scale kognitio hadoop webinar
Meta scale kognitio hadoop webinar
Kognitio
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
Acquia
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
DATAVERSITY
 

Similar to MySQL Optimization from a Developer's point of view (20)

Breaking data
Breaking dataBreaking data
Breaking data
 
Storage Systems For Scalable systems
Storage Systems For Scalable systemsStorage Systems For Scalable systems
Storage Systems For Scalable systems
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
 
Meta scale kognitio hadoop webinar
Meta scale kognitio hadoop webinarMeta scale kognitio hadoop webinar
Meta scale kognitio hadoop webinar
 
Introduction to SharePoint for SQLserver DBAs
Introduction to SharePoint for SQLserver DBAsIntroduction to SharePoint for SQLserver DBAs
Introduction to SharePoint for SQLserver DBAs
 
Optimising Queries - Series 1 Query Optimiser Architecture
Optimising Queries - Series 1 Query Optimiser ArchitectureOptimising Queries - Series 1 Query Optimiser Architecture
Optimising Queries - Series 1 Query Optimiser Architecture
 
Hard Coding as a design approach
Hard Coding as a design approachHard Coding as a design approach
Hard Coding as a design approach
 
Meta scale kognitio hadoop webinar
Meta scale kognitio hadoop webinarMeta scale kognitio hadoop webinar
Meta scale kognitio hadoop webinar
 
NYJavaSIG - Big Data Microservices w/ Speedment
NYJavaSIG - Big Data Microservices w/ SpeedmentNYJavaSIG - Big Data Microservices w/ Speedment
NYJavaSIG - Big Data Microservices w/ Speedment
 
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site ReviewECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
 
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 
e-Learning Delivery System : The Challenges
e-Learning Delivery System : The Challengese-Learning Delivery System : The Challenges
e-Learning Delivery System : The Challenges
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
Perf tuning2
Perf tuning2Perf tuning2
Perf tuning2
 
Redshift deep dive
Redshift deep diveRedshift deep dive
Redshift deep dive
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
 
Where Django Caching Bust at the Seams
Where Django Caching Bust at the SeamsWhere Django Caching Bust at the Seams
Where Django Caching Bust at the Seams
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 

MySQL Optimization from a Developer's point of view

  • 1.
  • 2. MySQL Optimization Tips to increase performance Sachin Khosla Founder, Digimantra.com
  • 3. What’s next ?  MySQL – What’s that ?  Optimize ? Where and What ?  Quick Glance at the famous MySQL Storage Engines  Many ways but we talk about Cache systems  Query Cache  File Cache  MemCached  Solr/Lucene
  • 4. Let’s Go ! Have a question ? • If it’s a short – Shoot it ? • If it’s a long – Save it till end of the session :)
  • 5. As many of you know ! •MySQL is a relational database •Community Edition is free of cost •Free GUI tools for Server Administration •Support by the community, forums, manual/docs etc.
  • 6. Why Optimize • Cost • Tuned system = less resources = less investment. • After tuning the system, you get a real usage stat. • Performance • Performance of the system increases the output :) • Happy developers = Happy end users • Stay in the game • Undoubtedly you want to keep pace with the latest technology • Faster systems showcase helps bring in more business
  • 7. Who Should Optimize? Ecosystem – Who are responsible in developing that very application. 1. Designers – The documenting guys :) 2. Developers – Geeks :D 3. System/DB Administrators – The machines :P
  • 8. Optimized, Really ? • Benchmarking • Profiling • Difference between the Benchmark & Profiling Ref - http://dev.mysql.com/tech-resources/articles/pro-mysql-ch6.html
  • 9. MySQL flavors •MyISAM – The ideal son •InnoDB – Clever but expensive* •Memory (Heap)
  • 10. MyISAM InnoDB •Of course, there is no •Of course, there is no difference. It’s just you ! difference. It’s just you ! •You need speed and term •You understand, what “transaction” is martian for transactions are and how are you. they going to effect. •You sure about the size of •Sky is the limit – did you the data in your database. smell cloud computing,eh? •Data is stored in insertion •Rows are physically ordered order. (no clustered index) by the primary key
  • 11. Memory (Heap) • Faster, Performance booster • Intermediary table • Use it when you have more select than insert • Table Structure remains not the data • Fixed length for data types like varchar • No support for text, blob
  • 12. Finally, ways to boost performance • Mysql Query Cache • File Cache system • Memcached • Solr / Lucene
  • 13. Mysql Query Cache • Internal cache system of MySQL • Caches the queries being fired • Never returns stale data • Good when you have less or almost no inserts • Be sure to choose an optimum size for cache (query_cache_size)
  • 14. File Cache system • Traditional way of caching with files. • Saves database server ping. • Still accesses the file structure. • No Big Deal !
  • 15. Memcached • How is it different than traditional cache ? • Can it improve my site’s application’s performance ? • How ? $mem = new Memcache(); //PECL extn in PHP $mem->connect(‘SERVER_NAME’,’PORT_NO’); //connect $mem->set(‘key’,’data’); //set memcached KV pair $mem->get(‘key’); //get data
  • 16.
  • 17. Solr / Lucene •Hit highlighting, faceted search, caching, replication, and a web administration interface – Heavy terms ? •In simple terms it’s a server which has indexes of the database and when you send a request to it, it return you data in the form of XML/JSON
  • 18. Other ways • Query Optimization • Using Explain • Show table status (InnoDB / MySQL) • Show InnoDB status (indexes and all ) •Table level Optimization • Normalization • DB Server Level • mysqld status • Process monitoring tools
  • 19. Q&A
  • 20. Thank you ! www.digimantra.com Twitter - @realin FB – http://fb.me/sachinkhosla