Don't run SQL when we don't have to