Embed presentation
Download as PDF, PPTX















![© 2014 PERCONA Buffer Pool • It’s crucial that queries read an index from memory; I/O during an index scan kills performance. [mysqld]! innodb_buffer_pool_size = 64M # wrong! innodb_buffer_pool_size = 2G # better!](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fsqlquerypatternsoptimized-130322094045-phpapp02%2f75%2fSql-query-patterns-optimized-16-2048.jpg&f=jpg&w=240)










































































































This document discusses various techniques for optimizing MySQL queries, including queries for exclusion joins, random selection, and greatest per group. For a query seeking movies without directors, solutions using NOT EXISTS, NOT IN, and outer joins are examined. The outer join solution performed best by taking advantage of a "not exists" optimization. For random selection of a movie, an initial naive solution using ORDER BY RAND() is shown to be inefficient, prompting discussion of alternative approaches.















![© 2014 PERCONA Buffer Pool • It’s crucial that queries read an index from memory; I/O during an index scan kills performance. [mysqld]! innodb_buffer_pool_size = 64M # wrong! innodb_buffer_pool_size = 2G # better!](/image.pl?url=https%3a%2f%2fimage.slidesharecdn.com%2fsqlquerypatternsoptimized-130322094045-phpapp02%2f75%2fSql-query-patterns-optimized-16-2048.jpg&f=jpg&w=240)








































































































