By quering on all variants instead of storing them both inserts and lookups are about twice as fast.