Database optimizations.