I wrote:
(...) Otherwise, maybe build a named database with {key = record ID, data = original key}.
Whoops, I meant provided the other data is also in named database(s). Database names are inserted as keys in the database with name=NULL, which is why NULL database and named database should not be mixed.