Improve the ancestry db complexity