Once https://github.com/pouchdb/pouchdb/issues/6055 is fixed, we can replace the previous in-memory optimization with a proper in-database optimization that actually works across threads.