Even more SQL improvements.