“Not optimal” sort of understates it honestly, it is a textbook bottleneck. You’re only allowing a single reader / writer to the table at a time (at least, for any reader / writer that has to perform that sort of operation).
The inherent tension with all of these solutions is that at 0 scale they’re all fine. At any scale they’re all sorta bad because we are working with an arbitrary JSON blob, with the unique index being the best option because you need it anyway to make the get_by part scale, so may as well make it unique and upsert.
Ultimately I sort of what to revisit the concept of “Find or create by JSON blob”. Is there really nothing more unique? What is it?






















