Some tricks for MySQL I learned

Oct 24, 2025

  • innodb_buffer_pool_size should be given 50% to 80% of total RAM. So that more tables could be cached in RAM, reducing chances of using hard drive and slowing down queries.
  • "Write-heavy tables should not use index" is a lousy statement. One of the fixes a team discovered to enhance an upload process speed is putting two indexes in a column to be used in an UPDATE JOIN statement. It SLAHSED the time taken by 99%. It doesn't mean to put indexes in every column, in every table. Test and verify.
  • If you have SELECT ... WHERE a = AND b =, index (a, b) is better than index a and index b separate. INDEX JOIN is expensive.
  • MySQL slow query log should be turned on to monitor for any slow queries. As with caching, or saving precomputed results of commonly used queries.
  • EXPLAIN and ANALYZE are your best friend. EXPLAIN will tell you what the database plans to do, while ANALYZE will run the query AND explain what it did.