Agile Data

Catalog of Database Refactorings

Follow @scottwambler on Twitter!

A database refactoring is a small change to your database schema which improves its design without changing its semantics. This catalog is organized into several categories of database refactoring:
  • Structural. A change to the table structure of your database schema.
  • Data quality. A change which improves and/or ensures the consistency and usage of the values stored within the database.
  • Referential integrity. A change which ensures that a referenced row exists within another table and/or that ensures that a row which is no longer needed is removed appropriately. 
  • Architectural. A change which improves the overall manner in which external programs interact with a database.
  • Method. A change which improves the quality of a stored procedure, stored function, or trigger. 
  • Non-refactoring transformations. A change which changes the semantics of your database schema by adding new elements to it or by modifying existing elements. 
Category Database Refactorings
Structural Refactorings
Data Quality Refactorings
Referential Integrity Refactorings
Architectural Refactorings
Method Refactorings
Non-Refactoring Transformations


Refactoring Databases This book describes, in detail, how to refactor a database schema to improve its design. The first section of the book overviews the fundamentals evolutionary database techniques in general and of database refactoring in detail. More importantly it presents strategies for implementing and deploying database refactorings, in the context of both "simple" single application databases and in "complex" multi-application databases. The second section, the majority of the book, is a database refactoring reference catalog. It describes over 60 database refactorings, presenting data models overviewing each refactoring and the code to implement it.