A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Idea: Automated testing of database schema design

When writing or maintaining a MySQL database schema, there are a number quality checks that could conceivably be automated:

  • Run the test suite and print out all the SQL statements it runs (e.g. for Perl set DBIC_TRACE=1). Now check that every column mentioned in a `where` clause has an index on it.
  • Indexes are defined by: `KEY` or `UNIQUE` next to them
  • Indexes are probably most important on large data tables, so identify those manually.