Fantastic, thank you! I think I have everything I need to make this work now (and it works quite well with a draft implementing your notes).
Do you know if that index we talked about above has been added? I think lookups are a bit too slow currently, and that index would probably speed them up to a single-digit ms per query.