ti conviene che ti estrai tutti i dati dal primo database, ti costruisci la chiave di ricerca e lanci la query li su postgresql