optimize db to avoid doublon during insert