Best Practices for Safe PostgreSQL Schema Migrations
When you change a PostgreSQL schema in production, the database has to keep serving queries while you roll out new application versions…
When a MySQL query slows down, start by finding out how the server answers it. You optimize MySQL to make queries run faster and help the server handle more traffic. To do that, you inspect execution plans, server activity, data statistics, indexes, and InnoDB settings. An execution plan is the sequence of steps MySQL chooses to find and combine rows for a query.
To tune MySQL reliably, find a bottleneck in your workload, test one targeted change, and measure again with representative traffic. MySQL 26.10 came out on October 20, 2026, though many of the techniques in its documentation were already around before 2026. Because behavior and settings vary by release, check the manual for the version running on your server. The MySQL 26.10 release notes list the changes in that release.
Before you change server settings, look at what MySQL plans to do and what it does in practice. Run EXPLAIN to see the execution plan MySQL expects to use. For supported statements, run EXPLAIN ANALYZE to execute the statement and report each step's real time, row count, and loop count alongside MySQL's estimates. MySQL calls each plan step an iterator, which might read rows from an index or join two inputs. The EXPLAIN documentation covers the available output and version-specific limits.
If MySQL's estimated row count is far off from the real count, find out why. For example, if the optimizer expects a filter to return a few rows but the plan step reads many, check the condition, how values are distributed in the column, and how MySQL locates the rows before you touch server settings. An execution plan shows how MySQL intends to run a query, while measured execution shows how that plan behaves against your current data.
Because EXPLAIN ANALYZE runs the statement, account for its side effects and resource cost before you use it. For broader bottlenecks, turn to MySQL's Performance Schema, which records instrumented server activity that MySQL is configured to track, such as statements, waits, and input/output operations. The sys schema wraps some of that data in views that are easier to read. MySQL's Performance Schema diagnosis examples walk through starting from a repeatable workload and investigating collected events. MySQL holds Performance Schema data in memory, and what it captures depends on your configuration and instrumentation.
MySQL's optimizer relies on table statistics to estimate how many rows match a condition, then uses that estimate to pick an execution plan. A histogram summarizes how values are spread across a column. MySQL uses histograms to estimate how many rows a filter will match, especially when the column has no suitable index. The optimizer statistics documentation explains how MySQL combines histograms with other methods, including index-based estimates.
As your data changes, histograms can become stale. A more detailed estimate also does not guarantee a faster query. MySQL uses a default histogram size of 100 buckets, which you can configure from 1 to 1,024 in the 26.10 manual. You run ANALYZE TABLE to update table statistics and create or refresh histograms; the statement documentation lists its options. After you update statistics, compare the new plan and measured execution with the old ones. If the query slows down, check whether the optimizer's estimates or chosen access path changed.
An index gives MySQL a faster path to matching rows, but every index takes up storage and adds work whenever MySQL inserts, updates, or deletes rows. Add indexes to columns used by important queries you have measured instead of indexing every column that appears in your SQL. The MySQL index optimization guidance explains this trade-off.
To test whether the optimizer needs an index, you can mark it invisible and later make it visible again. MySQL ignores an invisible index when choosing a plan, while still keeping the index up to date on writes. When you mark an index invisible, you see how reads behave without it, though you do not see the storage or write savings you would get if you dropped it. Read the invisible index documentation before you use this technique.
MySQL also uses Index Condition Pushdown, which lets the storage engine - the part of MySQL that reads and stores table data - check some conditions against index entries before fetching full rows. In InnoDB, this helps eligible secondary-index queries by avoiding unnecessary row reads. The Index Condition Pushdown documentation explains when MySQL applies it.
The InnoDB buffer pool caches table and index data in memory. When you give InnoDB a larger buffer pool, it reads from storage less often if your active data fits in memory, but it leaves less memory for other processes on the machine. MySQL's 9.7 documentation notes that dedicated servers sometimes assign up to 80% of physical memory to the buffer pool. That 80% figure fits a dedicated database server, so adjust it if other processes share the machine. The buffer pool documentation also covers read-ahead, flushing, and preserving buffer-pool state across restarts.
InnoDB also writes changes to redo logs so it can recover after a crash. According to MySQL's documentation, a small redo-log capacity can force more checkpoint writes, while dedicated log-writer threads help depending on your concurrency level. The redo logging guidance connects these settings to workload behavior. Test any configuration change with representative traffic, and monitor both query speed and write activity. A setting that works well for steady traffic can behave differently during bursts or heavier concurrency.
MySQL HeatWave's Autopilot Indexing analyzes statement digests, which are summaries of executed statements, to recommend indexes to add or drop and estimate both workload benefits and storage impact. Its documentation requires at least five queries in representative digest history and lists statements and data types it does not evaluate. These recommendations belong to the HeatWave Autopilot Indexing feature and do not act as a general index advisor for every MySQL installation. Compare each recommendation against your real workload, then measure its effect before you adopt it.
Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.
Take a look at vroni.com