Write relations by first index. Reduce db size by 40%