Optimize relations before reading them