Quick And Easy Guide To Speeding Up MySQL for web developers

1,956 views

Published on

A presentation given for PHP West Midlands in March 2009

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,956
On SlideShare
0
From Embeds
0
Number of Embeds
392
Actions
Shares
0
Downloads
38
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Quick And Easy Guide To Speeding Up MySQL for web developers

  1. 1. The Quick and Easy Guide to Speeding up MySQL For Website Developers
  2. 2. The Quick and Easy Guide to Speeding up MySQL
  3. 3. Introduction Presentation for developers who only tune up MySQL when they really have to. Basic steps and good practices for using and speeding up MySQL - so that MySQL will work better for you.
  4. 4. Introduction 90% of the reasons why MySQL is slow is due to bad schema design.. or in other words how the database is setup vs how you use it. MySQL is fast. No really, it is. It just needs some attention every now and then.
  5. 5. Monitoring We use Nagios to monitor MySQL. Some examples.. What you can't measure, you can't improve EXPLAIN SELECT. Some examples.. Benchmarking Whole application or some scripts? Profiling (and slowlog)
  6. 6. Choosing the Right Data Type Int/Decimal/Char/Varchar/..... Text/BLOB Enum/Set DateTime /Timestamp  (..update current_timestamp) Unsigned/Signed Null/Not Null Procedure Analyse()
  7. 7. Choosing the Right Storage Engine MyISAM vs InnoDB Table Locking Vs Row-level Locking Memory Archive CSV
  8. 8. Some MySQL Internals Key Buffer Innodb Buffer Pool Size Query Cache Thread Cache Temp Tables (Memory Vs on-Disk) Optimize tables Partitioning (MySQL 5.1)
  9. 9. Replication Mostly Reads Master-Slave Mostly Writes Master-Master Backups High Availability
  10. 10. Application Side Improvements Storing Duplicate Data De-normalize Stored Results (Summary/Cache Table) Count() in its own Table Stored Conditions Stored Reports Involving the database much more with your application
  11. 11. Application Side Improvements Unix Philosophy - Rule of Representation quot;Fold knowledge into data, so program logic can be stupid and robust.quot; quot;Even the simplest procedural logic is hard for humans to verify, but quite complex data structures are fairly easy to model and reason about.quot; John Bently
  12. 12. The End Q&A hope you found  the presentation useful

×