• Save
My sql performance
Upcoming SlideShare
Loading in...5

My sql performance



This presentation describes commonly faced MySQL performance issues and share best practices for improving performance.

This presentation describes commonly faced MySQL performance issues and share best practices for improving performance.



Total Views
Views on SlideShare
Embed Views



38 Embeds 1,603

http://java.dzone.com 897
http://n-chandra.blogspot.in 209
http://n-chandra.blogspot.com 147
http://mysqltag.tistory.com 112
http://www.linkedin.com 40
http://n-chandra.blogspot.co.uk 29
http://n-chandra.blogspot.ca 19
http://n-chandra.blogspot.de 19
https://www.linkedin.com 12
http://n-chandra.blogspot.ie 12
http://n-chandra.blogspot.ru 10
http://n-chandra.blogspot.kr 10
http://n-chandra.blogspot.jp 7
http://www.dzone.com 7
http://n-chandra.blogspot.com.br 7
http://n-chandra.blogspot.fr 6
http://n-chandra.blogspot.com.es 6
http://n-chandra.blogspot.com.au 5
http://architects.dzone.com 5
http://n-chandra.blogspot.pt 4
http://n-chandra.blogspot.com.ar 4
http://n-chandra.blogspot.it 4
http://n-chandra.blogspot.nl 3
http://n-chandra.blogspot.ro 3
http://n-chandra.blogspot.co.at 3
http://n-chandra.blogspot.ch 3
http://n-chandra.blogspot.co.il 3
http://www.blogger.com 3
http://dzone.com 3
http://n-chandra.blogspot.cz 2
http://n-chandra.blogspot.gr 2
http://n-chandra.blogspot.se 1
http://n-chandra.blogspot.dk 1
http://n-chandra.blogspot.hk 1
http://n-chandra.blogspot.no 1
http://g2m1 1
http://n-chandra.blogspot.hu 1
http://n-chandra.blogspot.tw 1



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

My sql performance My sql performance Presentation Transcript

  • Solving MySQL Performance Issues
  • Problems• Overview – Most of the tables de-normalized / 2nd normal form – Way too many indexes – Missing constraints – No subtype relationships – Repetitive data – Inconsistent naming convention – Wrong choice of datatypes – No partitioning
  • Data Issues• Severe requirement for data standardization?• Oversized datatypes having incorrect data text/bigint)• Nullable columns• Unique constraints not present where required creating duplicates in master tables
  • Performance Issues• Due to oversized columns and row sizes, number of rows fitting in a page is less, causing more IO• Joins requiring more memory• All sorts goes for temporary file creation on disk increasing IO• Lock (shared / Exclusive) time increase due to above reasons, reducing concurrency• Memory inefficiently used due to oversized rows.• Every update, needs to update unnecessary indexes increasing lock time.
  • Fixes1. Reduce the number of rows by creating archive db.2. Remove unwanted indexes and reduce insert/update overheads3. Upgrade to MySQL 5.54. Partitioning ?
  • Short Term fixes at Application tier• Set isolation level to READ_COMMITTED• Set dynamic update and dynamic insert = TRUE. 95% of the updates update all columns even if few columns are modified.• Review transaction boundaries. Few flows dont close (commit/rollback) leaving open transactions• Query tuning – Not all hibernate queries are optimal. Most of them do left outer join even when not required.• Query tuning – Review queries not using indexes, badly formed queries• Most queries bring all columns (Select *) and usually discarded. This is an overhead on cache, n/w and the app. Tier session as well.
  • Long Term Fixes1. Schema changes (Normalized, smaller tables)2. Partitioning3. Sharding (Application aware / Abstract)4. Fan- In topology or Cluster
  • Master – Master Setup• In order scale writes, this is usually a technique that is used. However here are pit falls – – Management of auto increment columns – A violation of a constraint on one of the masters can break replication rendering the failed master as slave – Resyncing of masters is time consuming and error prone (replication limitation)