SlideShare a Scribd company logo
15 Pro-tips for MySQL Users PFCongress - 17 september 2011 Utrecht - Netherlands
Joshua Thijssen Senior Software Engineer @ Enrise Development in PHP, Python, Perl, C, Java.... Email:  [email_address] Twitter: @jaytaph Blogs: http://www.adayinthelifeof.nl http://www.enrise.com/blog
[object Object],[object Object],[object Object],What are we going to  discuss? ,[object Object]
[object Object],Tip  0 ,[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],Tip 0:   Use the correct MySQL version http://distrowatch.com/table.php?distribution=redhat http://distrowatch.com/table.php?distribution=debian
[object Object],Tip  1 ,[object Object]
[object Object],[object Object],Tip 1:   Know your EXPLAIN  (1)
Tip 1:   Know your EXPLAIN  (2) mysql> desc varchartest;+----------+--------------+------+-----+---------+-------+| Field  | Type  | Null | Key | Default | Extra |+----------+--------------+------+-----+---------+-------+| id  | int(11)  | NO  | PRI | 0  |  || name  | varchar(255) | NO  | MUL | NULL  |  || utf8name | varchar(255) | NO  | MUL | NULL  |  |+----------+--------------+------+-----+---------+-------+3 rows in set (0.01 sec)
Tip 1:   Know your EXPLAIN  (3) mysql> EXPLAIN EXTENDED  ->  SELECT * FROM varchartest WHERE name LIKE 'joshua';+----+-------------+-------------+-------+---------------+----------+---------+------+------+----------+-------------+| id | select_type | table  | type  | possible_keys | key  | key_len | ref  | rows | filtered | Extra  |+----+-------------+-------------+-------+---------------+----------+---------+------+------+----------+-------------+|  1 | SIMPLE  | varchartest | range | idx_name  | idx_name | 257  | NULL |  1 |  100.00 | Using where |+----+-------------+-------------+-------+---------------+----------+---------+------+------+----------+-------------+1 row in set, 1 warning (0.01 sec)
Tip 1:   Know your EXPLAIN  (4) mysql> SHOW WARNINGS+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| Level | Code | Message  |+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| Note  | 1003 | select `pfz`.`varchartest`.`id` AS `id`,`pfz`.`varchartest`.`name` AS `name`,`pfz`.`varchartest`.`utf8name` AS `utf8name` from `pfz`.`varchartest` where (`pfz`.`varchartest`.`name` like 'joshua') |+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Tip 1:   Know your PROFILER  (1) mysql> SET profiling=1;mysql> SELECT * FROM table; mysql> SHOW PROFILE CPU, BLOCK IO; +--------------------------------+----------+----------+------------+--------------+---------------+| Status  | Duration | CPU_user | CPU_system | Block_ops_in | Block_ops_out |+--------------------------------+----------+----------+------------+--------------+---------------+| starting  | 0.000930 | 0.000000 |  0.000000 |  0 |  8 || checking query cache for query | 0.000547 | 0.000000 |  0.000000 |  0 |  0 || checking permissions  | 0.000045 | 0.000000 |  0.000000 |  0 |  0 || Opening tables  | 0.000142 | 0.000000 |  0.000000 |  0 |  0 || System lock  | 0.000030 | 0.000000 |  0.000000 |  0 |  0 || Table lock  | 0.000045 | 0.000000 |  0.000000 |  0 |  0 || init  | 0.000207 | 0.000000 |  0.000000 |  0 |  0 || optimizing  | 0.000007 | 0.000000 |  0.000000 |  0 |  0 || statistics  | 0.000068 | 0.000000 |  0.000000 |  0 |  0 || preparing  | 0.001393 | 0.004000 |  0.000000 |  0 |  0 || Creating tmp table  | 0.001658 | 0.000000 |  0.000000 |  0 |  8 || executing  | 0.000005 | 0.000000 |  0.000000 |  0 |  0 || Copying to tmp table  | 0.000834 | 0.000000 |  0.004001 |  0 |  8 || Sorting result  | 0.000179 | 0.000000 |  0.000000 |  0 |  0 || Sending data  | 0.000089 | 0.000000 |  0.000000 |  0 |  0 || end  | 0.000022 | 0.000000 |  0.000000 |  0 |  0 || removing tmp table  | 0.000089 | 0.000000 |  0.000000 |  0 |  0 || end  | 0.000005 | 0.000000 |  0.000000 |  0 |  0 || query end  | 0.000004 | 0.000000 |  0.000000 |  0 |  0 || freeing items  | 0.000844 | 0.000000 |  0.000000 |  0 |  0 || logging slow query  | 0.000023 | 0.000000 |  0.000000 |  0 |  0 || logging slow query  | 0.000060 | 0.000000 |  0.000000 |  0 |  8 || cleaning up  | 0.000007 | 0.000000 |  0.000000 |  0 |  0 |+--------------------------------+----------+----------+------------+--------------+---------------+
[object Object],Tip  2 ,[object Object]
Tip 2: My.cnf settings  (1) Know the most important ones: key_buffer_size, innodb_buffer_pool_size,  sort_buffer_size, max_connections
[object Object],[object Object],Tip 2:   My.cnf settings  (2)
[object Object],[object Object],[object Object],[object Object],Tip 2:   My.cnf settings  (3)
[object Object],Tip  3 ,[object Object]
[object Object],[object Object],[object Object],Tip 3:   Backup on table level  (1) ,[object Object]
[object Object],Tip  4 ,[object Object]
[object Object],[object Object],[object Object],Tip 4:   Select *  (1) ,[object Object]
Tip 4:   Select *  (2) mysql> SHOW FULL COLUMNS FROM `covering`;+--------------+------------------+------------------+------+-----+---------+----------------+ | Field  | Type  | Collation  | Null | Key | Default | Extra  | +--------------+------------------+------------------+------+-----+---------+----------------+| id  | int(10) unsigned | NULL  | NO  | PRI | NULL  | auto_increment || email  | varchar(255)  | ascii_general_ci | NO  | MUL | NULL  |  |  | want_mailing | tinyint(1)  | NULL  | NO  | MUL | NULL  |  | | extra_info  | varchar(255)  | ascii_general_ci | NO  | MUL | NULL  |  |+--------------+------------------+------------------+------+-----+---------+----------------+3 rows in set (0.00 sec)mysql> SHOW INDEXES FROM `covering`;+----------+------------+------------+--------------+--------------+-----------+-------------+| Table  | Non_unique | Key_name  | Seq_in_index | Column_name  | Collation | Cardinality | +----------+------------+------------+--------------+--------------+-----------+-------------+| covering |  0 | PRIMARY  |  1 | id  | A  |  3 || covering |  1 | idx_email  |  1 | email  | A  |  3 || covering |  1 | idx_email  |  2 | want_mailing | A  |  3 || covering |  1 | idx_email2 |  1 | want_mailing | A  |  1 || covering |  1 | idx_email2 |  2 | email  | A  |  3 |+----------+------------+------------+--------------+--------------+-----------+-------------+5 rows in set (0.01 sec)
Tip 4:   Select *  (2) mysql> EXPLAIN SELECT want_mailing FROM `covering` WHERE email LIKE ' [email_address] ';+----+-------------+----------+-------+---------------+-----------+---------+------+------+--------------------------+| id | select_type | table  | type  | possible_keys | key  | key_len | ref  | rows | Extra  |+----+-------------+----------+-------+---------------+-----------+---------+------+------+--------------------------+|  1 | SIMPLE  | covering | range | idx_email  | idx_email | 257  | NULL |  1 | Using where; Using index |+----+-------------+----------+-------+---------------+-----------+---------+------+------+--------------------------+1 row in set (0.00 sec)
[object Object],Tip  5 ,[object Object]
[object Object],[object Object],[object Object],Tip 5: Triggers and stored procedures  (1) ,[object Object]
[object Object],Tip  6 ,[object Object]
[object Object],[object Object],[object Object],[object Object],Tip 6:   Don’t use FULLTEXT search  (1) ,[object Object]
[object Object],Tip  7 ,[object Object]
[object Object],[object Object],[object Object],Tip 7:   Wildcard searches  (1) ,[object Object]
[object Object],Tip  8 ,[object Object]
Tip 8:   Sharding  (1) mysql> SHOW FULL COLUMNS FROM `pages`;+------------+------------------+-------------------+------+-----+-------------------+-------+| Field  | Type  | Collation  | Null | Key | Default  | Extra |+------------+------------------+-------------------+------+-----+-------------------+-------+| page_id  | int(10) unsigned | NULL  | NO  | PRI | NULL  |  || created_dt | timestamp  | NULL  | NO  |  | CURRENT_TIMESTAMP |  || creator_id | int(11)  | NULL  | NO  |  | NULL  |  || title  | varchar(100)  | latin1_swedish_ci | NO  |  | NULL  |  || contents  | text  | latin1_swedish_ci | NO  |  | NULL  |  || hit_count  | int(11)  | NULL  | NO  |  | 0  |  |+------------+------------------+-------------------+------+-----+-------------------+-------+6 rows in set (0.01 sec)
[object Object],[object Object],[object Object],Tip 8:   Sharding  (2)
[object Object],[object Object],[object Object],[object Object],Tip 8:   Sharding  (3)
[object Object],Tip 8:   Sharding  (4)
[object Object],Tip  9 ,[object Object]
[object Object],[object Object],Tip 9: Large primary keys  (1)
[object Object],Tip  10 ,[object Object],[object Object]
[object Object],[object Object],Tip 10:   SELECT COUNT(*)  (1)
[object Object],[object Object],Tip 10:   SELECT COUNT(*)  (2)
[object Object],Tip  11 ,[object Object]
Tip 11:   VARCHAR()  (1) ,[object Object]
[object Object],Tip 11:   VARCHAR()  (3) mysql> SHOW FULL COLUMNS FROM `varchartest`;+----------+--------------+-------------------+------+-----+---------+-------+| Field  | Type  | Collation  | Null | Key | Default | Extra |+----------+--------------+-------------------+------+-----+---------+-------+| id  | int(11)  | NULL  | NO  | PRI | 0  |  || name  | varchar(255) | latin1_swedish_ci | NO  | MUL | NULL  |  || utf8name | varchar(255) | utf8_general_ci  | NO  | MUL | NULL  |  |+----------+--------------+-------------------+------+-----+---------+-------+3 rows in set (0.01 sec)mysql> SHOW INDEXES FROM `varchartest`;+-------------+------------+--------------+--------------+-------------+-----------+-------------+| Table  | Non_unique | Key_name  | Seq_in_index | Column_name | Collation | Cardinality |+-------------+------------+--------------+--------------+-------------+-----------+-------------+| varchartest |  0 | PRIMARY  |  1 | id  | A  |  3 || varchartest |  1 | idx_name  |  1 | name  | A  |  3 || varchartest |  1 | idx_utf8name |  1 | utf8name  | A  |  3 |+-------------+------------+--------------+--------------+-------------+-----------+-------------+3 rows in set (0.00 sec)
[object Object],Tip 11:   VARCHAR()  (3) mysql> EXPLAIN SELECT * FROM `varchartest` WHERE name LIKE 'jthijssen';+----+-------------+-------------+-------+---------------+----------+---------+------+------+-------------+| id | select_type | table  | type  | possible_keys | key  | key_len | ref  | rows | Extra  |+----+-------------+-------------+-------+---------------+----------+---------+------+------+-------------+|  1 | SIMPLE  | varchartest | range | idx_name  | idx_name | 257  | NULL |  1 | Using where |+----+-------------+-------------+-------+---------------+----------+---------+------+------+-------------+1 row in set (0.00 sec)
[object Object],Tip  12 ,[object Object]
[object Object],[object Object],[object Object],Tip 12:   UTF-8  (1)
Tip 12:   UTF-8  (1) mysql> SHOW FULL COLUMNS FROM `varchartest`;+----------+--------------+-------------------+------+-----+---------+-------+| Field  | Type  | Collation  | Null | Key | Default | Extra |+----------+--------------+-------------------+------+-----+---------+-------+| id  | int(11)  | NULL  | NO  | PRI | 0  |  || name  | varchar(255) | latin1_swedish_ci | NO  | MUL | NULL  |  || utf8name | varchar(255) | utf8_general_ci  | NO  | MUL | NULL  |  |+----------+--------------+-------------------+------+-----+---------+-------+3 rows in set (0.01 sec)mysql> SHOW INDEXES FROM `varchartest`;+-------------+------------+--------------+--------------+-------------+-----------+-------------+| Table  | Non_unique | Key_name  | Seq_in_index | Column_name | Collation | Cardinality |+-------------+------------+--------------+--------------+-------------+-----------+-------------+| varchartest |  0 | PRIMARY  |  1 | id  | A  |  3 || varchartest |  1 | idx_name  |  1 | name  | A  |  3 || varchartest |  1 | idx_utf8name |  1 | utf8name  | A  |  3 |+-------------+------------+--------------+--------------+-------------+-----------+-------------+3 rows in set (0.00 sec)
Tip 12:   UTF-8  (1) mysql> EXPLAIN SELECT * FROM `varchartest` WHERE name LIKE 'jthijssen';+----+-------------+-------------+-------+---------------+----------+---------+------+------+-------------+| id | select_type | table  | type  | possible_keys | key  | key_len | ref  | rows | Extra  |+----+-------------+-------------+-------+---------------+----------+---------+------+------+-------------+|  1 | SIMPLE  | varchartest | range | idx_name  | idx_name | 257  | NULL |  1 | Using where |+----+-------------+-------------+-------+---------------+----------+---------+------+------+-------------+1 row in set (0.00 sec) mysql> EXPLAIN SELECT * FROM `varchartest` WHERE utf8name LIKE 'jthijssen';+----+-------------+-------------+-------+---------------+--------------+---------+------+------+-------------+| id | select_type | table  | type  | possible_keys | key  | key_len | ref  | rows | Extra  |+----+-------------+-------------+-------+---------------+--------------+---------+------+------+-------------+|  1 | SIMPLE  | varchartest | range | idx_utf8name  | idx_utf8name | 767  | NULL |  1 | Using where |+----+-------------+-------------+-------+---------------+--------------+---------+------+------+-------------+1 row in set (0.01 sec)
[object Object],[object Object],Tip 12:   UTF-8  (1)
[object Object],Tip  13
[object Object],[object Object],[object Object],Tip 13:   Cardinality & Selectivity  (1)
Tip 13:   Cardinality & Selectivity  (2)
[object Object],[object Object],[object Object],Tip 13:   Cardinality & Selectivity  (3) country_id (max +-200, but effectively +- 50, maybe less)
[object Object],[object Object],Tip 13:   Cardinality & Selectivity  (4)
[object Object],[object Object],Tip 13:   Cardinality & Selectivity  (5)
[object Object],Tip  14 ,[object Object]
Tip 14:   Query caching  (1) mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name  | Value  |+-------------------------+----------+| Qcache_free_blocks  | 1  || Qcache_free_memory  | 16768400 || Qcache_hits  | 3860  || Qcache_inserts  | 975  || Qcache_lowmem_prunes  | 0  || Qcache_not_cached  | 486  || Qcache_queries_in_cache | 0  || Qcache_total_blocks  | 1  |+-------------------------+----------+8 rows in set (0.00 sec) mysql> select * from varchartest;+----+------+----------+| id | name | utf8name |+----+------+----------+|  1 | j  | joshua  ||  2 | j  | jeroen  ||  3 | d  | david  |+----+------+----------+3 rows in set (0.00 sec)mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name  | Value  |+-------------------------+----------+| Qcache_free_blocks  | 1  || Qcache_free_memory  | 16766864 || Qcache_hits  | 3860  || Qcache_inserts  | 976  || Qcache_lowmem_prunes  | 0  || Qcache_not_cached  | 486  || Qcache_queries_in_cache | 1  || Qcache_total_blocks  | 4  |+-------------------------+----------+8 rows in set (0.00 sec)
Tip 14:   Query caching  (2) mysql> select * from varchartest;+----+------+----------+| id | name | utf8name |+----+------+----------+|  1 | j  | joshua  ||  2 | j  | jeroen  ||  3 | d  | david  |+----+------+----------+3 rows in set (0.00 sec)mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name  | Value  |+-------------------------+----------+| Qcache_free_blocks  | 1  || Qcache_free_memory  | 16766864 || Qcache_hits  | 3861  || Qcache_inserts  | 976  || Qcache_lowmem_prunes  | 0  || Qcache_not_cached  | 486  || Qcache_queries_in_cache | 1  || Qcache_total_blocks  | 4  |+-------------------------+----------+8 rows in set (0.00 sec) mysql> select * from varchartest;+----+------+----------+| id | name | utf8name |+----+------+----------+|  1 | j  | joshua  ||  2 | j  | jeroen  ||  3 | d  | david  |+----+------+----------+3 rows in set (0.00 sec)mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name  | Value  |+-------------------------+----------+| Qcache_free_blocks  | 1  || Qcache_free_memory  | 16766864 || Qcache_hits  | 3860  || Qcache_inserts  | 976  || Qcache_lowmem_prunes  | 0  || Qcache_not_cached  | 486  || Qcache_queries_in_cache | 1  || Qcache_total_blocks  | 4  |+-------------------------+----------+8 rows in set (0.00 sec)
Tip 14:   Query caching  (3) mysql> select * from varchartest;+----+------+----------+| id | name | utf8name |+----+------+----------+|  1 | j  | joshua  ||  2 | j  | jeroen  ||  3 | d  | david  |+----+------+----------+3 rows in set (0.00 sec)mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name  | Value  |+-------------------------+----------+| Qcache_free_blocks  | 1  || Qcache_free_memory  | 16766864 || Qcache_hits  | 3861  || Qcache_inserts  | 976  || Qcache_lowmem_prunes  | 0  || Qcache_not_cached  | 486  || Qcache_queries_in_cache | 1  || Qcache_total_blocks  | 4  |+-------------------------+----------+8 rows in set (0.00 sec) mysql> select * from varchartest ORDER BY RAND();+----+------+----------+| id | name | utf8name |+----+------+----------+|  2 | j  | jeroen  ||  1 | j  | joshua  ||  3 | d  | david  |+----+------+----------+3 rows in set (0.05 sec)mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name  | Value  |+-------------------------+----------+| Qcache_free_blocks  | 1  || Qcache_free_memory  | 16766864 || Qcache_hits  | 3861  || Qcache_inserts  | 976  || Qcache_lowmem_prunes  | 0  || Qcache_not_cached  | 487  || Qcache_queries_in_cache | 1  || Qcache_total_blocks  | 4  |+-------------------------+----------+8 rows in set (0.00 sec)
SELECT * FROM table WHERE YEAR(created_dt) < YEAR(NOW()); vs SELECT * FROM table WHERE YEAR(created_dt) < ‘2010’; Tip 14:   Query caching  (4)
[object Object],Tip  15 ,[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],Tip 15:   Certify yourself  (1) ,[object Object]
Let’s  summarize ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Any  questions? ,[object Object],http://farm1.static.flickr.com/73/163450213_18478d3aa6_d.jpg
Daycamp for developers http://www.enrise.com http://www.daycamp4developers.com /
[object Object],[object Object]

More Related Content

What's hot

SQL techniques for faster applications
SQL techniques for faster applicationsSQL techniques for faster applications
SQL techniques for faster applications
Connor McDonald
 
Lecture3 mysql gui by okello erick
Lecture3 mysql gui by okello erickLecture3 mysql gui by okello erick
Lecture3 mysql gui by okello erick
okelloerick
 
Using Optimizer Hints to Improve MySQL Query Performance
Using Optimizer Hints to Improve MySQL Query PerformanceUsing Optimizer Hints to Improve MySQL Query Performance
Using Optimizer Hints to Improve MySQL Query Performance
oysteing
 
Percona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuningPercona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuning
Sergey Petrunya
 
Practica controlconcurrencia
Practica controlconcurrenciaPractica controlconcurrencia
Practica controlconcurrencia
María Luisa Velasco
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
Wim Godden
 
Lecture5 my sql statements by okello erick
Lecture5 my sql statements by okello erickLecture5 my sql statements by okello erick
Lecture5 my sql statements by okello erick
okelloerick
 
Lecture2 mysql by okello erick
Lecture2 mysql by okello erickLecture2 mysql by okello erick
Lecture2 mysql by okello erick
okelloerick
 
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Tesora
 
Explain2
Explain2Explain2
Explain2
Anis Berejeb
 
UKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tipsUKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tips
Connor McDonald
 
Sangam 19 - Analytic SQL
Sangam 19 - Analytic SQLSangam 19 - Analytic SQL
Sangam 19 - Analytic SQL
Connor McDonald
 
Sangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on AutonomousSangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on Autonomous
Connor McDonald
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Trace
oysteing
 
Sangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolestSangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolest
Connor McDonald
 
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
Sergey Petrunya
 
KScope19 - SQL Features
KScope19 - SQL FeaturesKScope19 - SQL Features
KScope19 - SQL Features
Connor McDonald
 
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
Sergey Petrunya
 

What's hot (18)

SQL techniques for faster applications
SQL techniques for faster applicationsSQL techniques for faster applications
SQL techniques for faster applications
 
Lecture3 mysql gui by okello erick
Lecture3 mysql gui by okello erickLecture3 mysql gui by okello erick
Lecture3 mysql gui by okello erick
 
Using Optimizer Hints to Improve MySQL Query Performance
Using Optimizer Hints to Improve MySQL Query PerformanceUsing Optimizer Hints to Improve MySQL Query Performance
Using Optimizer Hints to Improve MySQL Query Performance
 
Percona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuningPercona live-2012-optimizer-tuning
Percona live-2012-optimizer-tuning
 
Practica controlconcurrencia
Practica controlconcurrenciaPractica controlconcurrencia
Practica controlconcurrencia
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Lecture5 my sql statements by okello erick
Lecture5 my sql statements by okello erickLecture5 my sql statements by okello erick
Lecture5 my sql statements by okello erick
 
Lecture2 mysql by okello erick
Lecture2 mysql by okello erickLecture2 mysql by okello erick
Lecture2 mysql by okello erick
 
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
 
Explain2
Explain2Explain2
Explain2
 
UKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tipsUKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tips
 
Sangam 19 - Analytic SQL
Sangam 19 - Analytic SQLSangam 19 - Analytic SQL
Sangam 19 - Analytic SQL
 
Sangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on AutonomousSangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on Autonomous
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Trace
 
Sangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolestSangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolest
 
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
MySQL/MariaDB query optimizer tuning tutorial from Percona Live 2013
 
KScope19 - SQL Features
KScope19 - SQL FeaturesKScope19 - SQL Features
KScope19 - SQL Features
 
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...ANALYZE for executable statements - a new way to do optimizer troubleshooting...
ANALYZE for executable statements - a new way to do optimizer troubleshooting...
 

Viewers also liked

Traits & Mixins
Traits & Mixins Traits & Mixins
Traits & Mixins
Skills Matter
 
Mario
MarioMario
Mario
宗志 陈
 
Log experience
Log experienceLog experience
Log experience宗志 陈
 
Beanstalk
BeanstalkBeanstalk
Beanstalk
宗志 陈
 
bada-data-beautiful
bada-data-beautifulbada-data-beautiful
bada-data-beautiful宗志 陈
 
Pika
PikaPika
Disk and page cache
Disk and page cacheDisk and page cache
Disk and page cache
宗志 陈
 
Workshop unittesting
Workshop unittestingWorkshop unittesting
Workshop unittesting
Joshua Thijssen
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
Joshua Thijssen
 
Representation state transfer and some other important stuff
Representation state transfer and some other important stuffRepresentation state transfer and some other important stuff
Representation state transfer and some other important stuff
Joshua Thijssen
 
Moved 301
Moved 301Moved 301
Moved 301
Joshua Thijssen
 
15 protips for mysql users
15 protips for mysql users15 protips for mysql users
15 protips for mysql users
Joshua Thijssen
 
Alice & bob public key cryptography 101 - uncon dpc
Alice & bob  public key cryptography 101 - uncon dpcAlice & bob  public key cryptography 101 - uncon dpc
Alice & bob public key cryptography 101 - uncon dpc
Joshua Thijssen
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APT
Joshua Thijssen
 
PFZ WorkshopDay Linux - Advanced
PFZ WorkshopDay Linux - AdvancedPFZ WorkshopDay Linux - Advanced
PFZ WorkshopDay Linux - Advanced
Joshua Thijssen
 
PFZ WorkshopDay Linux - Basic
PFZ WorkshopDay Linux - BasicPFZ WorkshopDay Linux - Basic
PFZ WorkshopDay Linux - Basic
Joshua Thijssen
 
Paxos introduction
Paxos introductionPaxos introduction
Paxos introduction
宗志 陈
 
Leveldb background
Leveldb backgroundLeveldb background
Leveldb background
宗志 陈
 
Alice & bob public key cryptography 101
Alice & bob  public key cryptography 101Alice & bob  public key cryptography 101
Alice & bob public key cryptography 101
Joshua Thijssen
 

Viewers also liked (20)

Traits & Mixins
Traits & Mixins Traits & Mixins
Traits & Mixins
 
Mario
MarioMario
Mario
 
Log experience
Log experienceLog experience
Log experience
 
Beanstalk
BeanstalkBeanstalk
Beanstalk
 
bada-data-beautiful
bada-data-beautifulbada-data-beautiful
bada-data-beautiful
 
Pika
PikaPika
Pika
 
Disk and page cache
Disk and page cacheDisk and page cache
Disk and page cache
 
Workshop unittesting
Workshop unittestingWorkshop unittesting
Workshop unittesting
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
 
Representation state transfer and some other important stuff
Representation state transfer and some other important stuffRepresentation state transfer and some other important stuff
Representation state transfer and some other important stuff
 
Moved 301
Moved 301Moved 301
Moved 301
 
15 protips for mysql users
15 protips for mysql users15 protips for mysql users
15 protips for mysql users
 
Alice & bob public key cryptography 101 - uncon dpc
Alice & bob  public key cryptography 101 - uncon dpcAlice & bob  public key cryptography 101 - uncon dpc
Alice & bob public key cryptography 101 - uncon dpc
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APT
 
PFZ WorkshopDay Linux - Advanced
PFZ WorkshopDay Linux - AdvancedPFZ WorkshopDay Linux - Advanced
PFZ WorkshopDay Linux - Advanced
 
PFZ WorkshopDay Linux - Basic
PFZ WorkshopDay Linux - BasicPFZ WorkshopDay Linux - Basic
PFZ WorkshopDay Linux - Basic
 
Level db
Level dbLevel db
Level db
 
Paxos introduction
Paxos introductionPaxos introduction
Paxos introduction
 
Leveldb background
Leveldb backgroundLeveldb background
Leveldb background
 
Alice & bob public key cryptography 101
Alice & bob  public key cryptography 101Alice & bob  public key cryptography 101
Alice & bob public key cryptography 101
 

Similar to 15 protips for mysql users pfz

MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 Minutes
Sveta Smirnova
 
Beginner guide to mysql command line
Beginner guide to mysql command lineBeginner guide to mysql command line
Beginner guide to mysql command line
Priti Solanki
 
4. Data Manipulation.ppt
4. Data Manipulation.ppt4. Data Manipulation.ppt
4. Data Manipulation.ppt
KISHOYIANKISH
 
Advance MySQL Training by Pratyush Majumdar
Advance MySQL Training by Pratyush MajumdarAdvance MySQL Training by Pratyush Majumdar
Advance MySQL Training by Pratyush Majumdar
Pratyush Majumdar
 
My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2
Morgan Tocker
 
MySQLinsanity
MySQLinsanityMySQLinsanity
MySQLinsanity
Stanley Huang
 
Query Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New TricksQuery Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New Tricks
MYXPLAIN
 
MySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesMySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queries
Damien Seguy
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
Wim Godden
 
New index features in MySQL 8
New index features in MySQL 8New index features in MySQL 8
New index features in MySQL 8
Erik Frøseth
 
Introduction into MySQL Query Tuning
Introduction into MySQL Query TuningIntroduction into MySQL Query Tuning
Introduction into MySQL Query Tuning
Sveta Smirnova
 
Short Intro to PHP and MySQL
Short Intro to PHP and MySQLShort Intro to PHP and MySQL
Short Intro to PHP and MySQL
Jussi Pohjolainen
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
Sveta Smirnova
 
Mysql basics1
Mysql basics1Mysql basics1
Mysql basics1
Steffy Robert
 
Introduction To Lamp P2
Introduction To Lamp P2Introduction To Lamp P2
Introduction To Lamp P2
Amzad Hossain
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
Sveta Smirnova
 
MySQL SQL Tutorial
MySQL SQL TutorialMySQL SQL Tutorial
MySQL SQL Tutorial
Chien Chung Shen
 
Performance schema and sys schema
Performance schema and sys schemaPerformance schema and sys schema
Performance schema and sys schema
Mark Leith
 
Need for Speed: MySQL Indexing
Need for Speed: MySQL IndexingNeed for Speed: MySQL Indexing
Need for Speed: MySQL Indexing
MYXPLAIN
 
Undelete (and more) rows from the binary log
Undelete (and more) rows from the binary logUndelete (and more) rows from the binary log
Undelete (and more) rows from the binary log
Frederic Descamps
 

Similar to 15 protips for mysql users pfz (20)

MySQL Performance Schema in 20 Minutes
 MySQL Performance Schema in 20 Minutes MySQL Performance Schema in 20 Minutes
MySQL Performance Schema in 20 Minutes
 
Beginner guide to mysql command line
Beginner guide to mysql command lineBeginner guide to mysql command line
Beginner guide to mysql command line
 
4. Data Manipulation.ppt
4. Data Manipulation.ppt4. Data Manipulation.ppt
4. Data Manipulation.ppt
 
Advance MySQL Training by Pratyush Majumdar
Advance MySQL Training by Pratyush MajumdarAdvance MySQL Training by Pratyush Majumdar
Advance MySQL Training by Pratyush Majumdar
 
My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2My sql 5.7-upcoming-changes-v2
My sql 5.7-upcoming-changes-v2
 
MySQLinsanity
MySQLinsanityMySQLinsanity
MySQLinsanity
 
Query Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New TricksQuery Optimization with MySQL 5.6: Old and New Tricks
Query Optimization with MySQL 5.6: Old and New Tricks
 
MySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesMySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queries
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
New index features in MySQL 8
New index features in MySQL 8New index features in MySQL 8
New index features in MySQL 8
 
Introduction into MySQL Query Tuning
Introduction into MySQL Query TuningIntroduction into MySQL Query Tuning
Introduction into MySQL Query Tuning
 
Short Intro to PHP and MySQL
Short Intro to PHP and MySQLShort Intro to PHP and MySQL
Short Intro to PHP and MySQL
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
Mysql basics1
Mysql basics1Mysql basics1
Mysql basics1
 
Introduction To Lamp P2
Introduction To Lamp P2Introduction To Lamp P2
Introduction To Lamp P2
 
Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
MySQL SQL Tutorial
MySQL SQL TutorialMySQL SQL Tutorial
MySQL SQL Tutorial
 
Performance schema and sys schema
Performance schema and sys schemaPerformance schema and sys schema
Performance schema and sys schema
 
Need for Speed: MySQL Indexing
Need for Speed: MySQL IndexingNeed for Speed: MySQL Indexing
Need for Speed: MySQL Indexing
 
Undelete (and more) rows from the binary log
Undelete (and more) rows from the binary logUndelete (and more) rows from the binary log
Undelete (and more) rows from the binary log
 

Recently uploaded

Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 

Recently uploaded (20)

Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Artificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic WarfareArtificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic Warfare
 

15 protips for mysql users pfz

  • 1. 15 Pro-tips for MySQL Users PFCongress - 17 september 2011 Utrecht - Netherlands
  • 2. Joshua Thijssen Senior Software Engineer @ Enrise Development in PHP, Python, Perl, C, Java.... Email: [email_address] Twitter: @jaytaph Blogs: http://www.adayinthelifeof.nl http://www.enrise.com/blog
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8. Tip 1: Know your EXPLAIN (2) mysql> desc varchartest;+----------+--------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+----------+--------------+------+-----+---------+-------+| id | int(11) | NO | PRI | 0 | || name | varchar(255) | NO | MUL | NULL | || utf8name | varchar(255) | NO | MUL | NULL | |+----------+--------------+------+-----+---------+-------+3 rows in set (0.01 sec)
  • 9. Tip 1: Know your EXPLAIN (3) mysql> EXPLAIN EXTENDED -> SELECT * FROM varchartest WHERE name LIKE 'joshua';+----+-------------+-------------+-------+---------------+----------+---------+------+------+----------+-------------+| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |+----+-------------+-------------+-------+---------------+----------+---------+------+------+----------+-------------+| 1 | SIMPLE | varchartest | range | idx_name | idx_name | 257 | NULL | 1 | 100.00 | Using where |+----+-------------+-------------+-------+---------------+----------+---------+------+------+----------+-------------+1 row in set, 1 warning (0.01 sec)
  • 10. Tip 1: Know your EXPLAIN (4) mysql> SHOW WARNINGS+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| Level | Code | Message |+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| Note | 1003 | select `pfz`.`varchartest`.`id` AS `id`,`pfz`.`varchartest`.`name` AS `name`,`pfz`.`varchartest`.`utf8name` AS `utf8name` from `pfz`.`varchartest` where (`pfz`.`varchartest`.`name` like 'joshua') |+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  • 11. Tip 1: Know your PROFILER (1) mysql> SET profiling=1;mysql> SELECT * FROM table; mysql> SHOW PROFILE CPU, BLOCK IO; +--------------------------------+----------+----------+------------+--------------+---------------+| Status | Duration | CPU_user | CPU_system | Block_ops_in | Block_ops_out |+--------------------------------+----------+----------+------------+--------------+---------------+| starting | 0.000930 | 0.000000 | 0.000000 | 0 | 8 || checking query cache for query | 0.000547 | 0.000000 | 0.000000 | 0 | 0 || checking permissions | 0.000045 | 0.000000 | 0.000000 | 0 | 0 || Opening tables | 0.000142 | 0.000000 | 0.000000 | 0 | 0 || System lock | 0.000030 | 0.000000 | 0.000000 | 0 | 0 || Table lock | 0.000045 | 0.000000 | 0.000000 | 0 | 0 || init | 0.000207 | 0.000000 | 0.000000 | 0 | 0 || optimizing | 0.000007 | 0.000000 | 0.000000 | 0 | 0 || statistics | 0.000068 | 0.000000 | 0.000000 | 0 | 0 || preparing | 0.001393 | 0.004000 | 0.000000 | 0 | 0 || Creating tmp table | 0.001658 | 0.000000 | 0.000000 | 0 | 8 || executing | 0.000005 | 0.000000 | 0.000000 | 0 | 0 || Copying to tmp table | 0.000834 | 0.000000 | 0.004001 | 0 | 8 || Sorting result | 0.000179 | 0.000000 | 0.000000 | 0 | 0 || Sending data | 0.000089 | 0.000000 | 0.000000 | 0 | 0 || end | 0.000022 | 0.000000 | 0.000000 | 0 | 0 || removing tmp table | 0.000089 | 0.000000 | 0.000000 | 0 | 0 || end | 0.000005 | 0.000000 | 0.000000 | 0 | 0 || query end | 0.000004 | 0.000000 | 0.000000 | 0 | 0 || freeing items | 0.000844 | 0.000000 | 0.000000 | 0 | 0 || logging slow query | 0.000023 | 0.000000 | 0.000000 | 0 | 0 || logging slow query | 0.000060 | 0.000000 | 0.000000 | 0 | 8 || cleaning up | 0.000007 | 0.000000 | 0.000000 | 0 | 0 |+--------------------------------+----------+----------+------------+--------------+---------------+
  • 12.
  • 13. Tip 2: My.cnf settings (1) Know the most important ones: key_buffer_size, innodb_buffer_pool_size, sort_buffer_size, max_connections
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. Tip 4: Select * (2) mysql> SHOW FULL COLUMNS FROM `covering`;+--------------+------------------+------------------+------+-----+---------+----------------+ | Field | Type | Collation | Null | Key | Default | Extra | +--------------+------------------+------------------+------+-----+---------+----------------+| id | int(10) unsigned | NULL | NO | PRI | NULL | auto_increment || email | varchar(255) | ascii_general_ci | NO | MUL | NULL | | | want_mailing | tinyint(1) | NULL | NO | MUL | NULL | | | extra_info | varchar(255) | ascii_general_ci | NO | MUL | NULL | |+--------------+------------------+------------------+------+-----+---------+----------------+3 rows in set (0.00 sec)mysql> SHOW INDEXES FROM `covering`;+----------+------------+------------+--------------+--------------+-----------+-------------+| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | +----------+------------+------------+--------------+--------------+-----------+-------------+| covering | 0 | PRIMARY | 1 | id | A | 3 || covering | 1 | idx_email | 1 | email | A | 3 || covering | 1 | idx_email | 2 | want_mailing | A | 3 || covering | 1 | idx_email2 | 1 | want_mailing | A | 1 || covering | 1 | idx_email2 | 2 | email | A | 3 |+----------+------------+------------+--------------+--------------+-----------+-------------+5 rows in set (0.01 sec)
  • 21. Tip 4: Select * (2) mysql> EXPLAIN SELECT want_mailing FROM `covering` WHERE email LIKE ' [email_address] ';+----+-------------+----------+-------+---------------+-----------+---------+------+------+--------------------------+| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |+----+-------------+----------+-------+---------------+-----------+---------+------+------+--------------------------+| 1 | SIMPLE | covering | range | idx_email | idx_email | 257 | NULL | 1 | Using where; Using index |+----+-------------+----------+-------+---------------+-----------+---------+------+------+--------------------------+1 row in set (0.00 sec)
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29. Tip 8: Sharding (1) mysql> SHOW FULL COLUMNS FROM `pages`;+------------+------------------+-------------------+------+-----+-------------------+-------+| Field | Type | Collation | Null | Key | Default | Extra |+------------+------------------+-------------------+------+-----+-------------------+-------+| page_id | int(10) unsigned | NULL | NO | PRI | NULL | || created_dt | timestamp | NULL | NO | | CURRENT_TIMESTAMP | || creator_id | int(11) | NULL | NO | | NULL | || title | varchar(100) | latin1_swedish_ci | NO | | NULL | || contents | text | latin1_swedish_ci | NO | | NULL | || hit_count | int(11) | NULL | NO | | 0 | |+------------+------------------+-------------------+------+-----+-------------------+-------+6 rows in set (0.01 sec)
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44. Tip 12: UTF-8 (1) mysql> SHOW FULL COLUMNS FROM `varchartest`;+----------+--------------+-------------------+------+-----+---------+-------+| Field | Type | Collation | Null | Key | Default | Extra |+----------+--------------+-------------------+------+-----+---------+-------+| id | int(11) | NULL | NO | PRI | 0 | || name | varchar(255) | latin1_swedish_ci | NO | MUL | NULL | || utf8name | varchar(255) | utf8_general_ci | NO | MUL | NULL | |+----------+--------------+-------------------+------+-----+---------+-------+3 rows in set (0.01 sec)mysql> SHOW INDEXES FROM `varchartest`;+-------------+------------+--------------+--------------+-------------+-----------+-------------+| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality |+-------------+------------+--------------+--------------+-------------+-----------+-------------+| varchartest | 0 | PRIMARY | 1 | id | A | 3 || varchartest | 1 | idx_name | 1 | name | A | 3 || varchartest | 1 | idx_utf8name | 1 | utf8name | A | 3 |+-------------+------------+--------------+--------------+-------------+-----------+-------------+3 rows in set (0.00 sec)
  • 45. Tip 12: UTF-8 (1) mysql> EXPLAIN SELECT * FROM `varchartest` WHERE name LIKE 'jthijssen';+----+-------------+-------------+-------+---------------+----------+---------+------+------+-------------+| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |+----+-------------+-------------+-------+---------------+----------+---------+------+------+-------------+| 1 | SIMPLE | varchartest | range | idx_name | idx_name | 257 | NULL | 1 | Using where |+----+-------------+-------------+-------+---------------+----------+---------+------+------+-------------+1 row in set (0.00 sec) mysql> EXPLAIN SELECT * FROM `varchartest` WHERE utf8name LIKE 'jthijssen';+----+-------------+-------------+-------+---------------+--------------+---------+------+------+-------------+| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |+----+-------------+-------------+-------+---------------+--------------+---------+------+------+-------------+| 1 | SIMPLE | varchartest | range | idx_utf8name | idx_utf8name | 767 | NULL | 1 | Using where |+----+-------------+-------------+-------+---------------+--------------+---------+------+------+-------------+1 row in set (0.01 sec)
  • 46.
  • 47.
  • 48.
  • 49. Tip 13: Cardinality & Selectivity (2)
  • 50.
  • 51.
  • 52.
  • 53.
  • 54. Tip 14: Query caching (1) mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name | Value |+-------------------------+----------+| Qcache_free_blocks | 1 || Qcache_free_memory | 16768400 || Qcache_hits | 3860 || Qcache_inserts | 975 || Qcache_lowmem_prunes | 0 || Qcache_not_cached | 486 || Qcache_queries_in_cache | 0 || Qcache_total_blocks | 1 |+-------------------------+----------+8 rows in set (0.00 sec) mysql> select * from varchartest;+----+------+----------+| id | name | utf8name |+----+------+----------+| 1 | j | joshua || 2 | j | jeroen || 3 | d | david |+----+------+----------+3 rows in set (0.00 sec)mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name | Value |+-------------------------+----------+| Qcache_free_blocks | 1 || Qcache_free_memory | 16766864 || Qcache_hits | 3860 || Qcache_inserts | 976 || Qcache_lowmem_prunes | 0 || Qcache_not_cached | 486 || Qcache_queries_in_cache | 1 || Qcache_total_blocks | 4 |+-------------------------+----------+8 rows in set (0.00 sec)
  • 55. Tip 14: Query caching (2) mysql> select * from varchartest;+----+------+----------+| id | name | utf8name |+----+------+----------+| 1 | j | joshua || 2 | j | jeroen || 3 | d | david |+----+------+----------+3 rows in set (0.00 sec)mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name | Value |+-------------------------+----------+| Qcache_free_blocks | 1 || Qcache_free_memory | 16766864 || Qcache_hits | 3861 || Qcache_inserts | 976 || Qcache_lowmem_prunes | 0 || Qcache_not_cached | 486 || Qcache_queries_in_cache | 1 || Qcache_total_blocks | 4 |+-------------------------+----------+8 rows in set (0.00 sec) mysql> select * from varchartest;+----+------+----------+| id | name | utf8name |+----+------+----------+| 1 | j | joshua || 2 | j | jeroen || 3 | d | david |+----+------+----------+3 rows in set (0.00 sec)mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name | Value |+-------------------------+----------+| Qcache_free_blocks | 1 || Qcache_free_memory | 16766864 || Qcache_hits | 3860 || Qcache_inserts | 976 || Qcache_lowmem_prunes | 0 || Qcache_not_cached | 486 || Qcache_queries_in_cache | 1 || Qcache_total_blocks | 4 |+-------------------------+----------+8 rows in set (0.00 sec)
  • 56. Tip 14: Query caching (3) mysql> select * from varchartest;+----+------+----------+| id | name | utf8name |+----+------+----------+| 1 | j | joshua || 2 | j | jeroen || 3 | d | david |+----+------+----------+3 rows in set (0.00 sec)mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name | Value |+-------------------------+----------+| Qcache_free_blocks | 1 || Qcache_free_memory | 16766864 || Qcache_hits | 3861 || Qcache_inserts | 976 || Qcache_lowmem_prunes | 0 || Qcache_not_cached | 486 || Qcache_queries_in_cache | 1 || Qcache_total_blocks | 4 |+-------------------------+----------+8 rows in set (0.00 sec) mysql> select * from varchartest ORDER BY RAND();+----+------+----------+| id | name | utf8name |+----+------+----------+| 2 | j | jeroen || 1 | j | joshua || 3 | d | david |+----+------+----------+3 rows in set (0.05 sec)mysql> show status like '%qcache%';+-------------------------+----------+| Variable_name | Value |+-------------------------+----------+| Qcache_free_blocks | 1 || Qcache_free_memory | 16766864 || Qcache_hits | 3861 || Qcache_inserts | 976 || Qcache_lowmem_prunes | 0 || Qcache_not_cached | 487 || Qcache_queries_in_cache | 1 || Qcache_total_blocks | 4 |+-------------------------+----------+8 rows in set (0.00 sec)
  • 57. SELECT * FROM table WHERE YEAR(created_dt) < YEAR(NOW()); vs SELECT * FROM table WHERE YEAR(created_dt) < ‘2010’; Tip 14: Query caching (4)
  • 58.
  • 59.
  • 60.
  • 61.
  • 62. Daycamp for developers http://www.enrise.com http://www.daycamp4developers.com /
  • 63.