-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NitriteCollection.update slow when unrelated properties in document are indexed #902
Comments
Thanks for the detailed analysis. I'll take a look at it |
@chris9182 the changes are in latest 4.2.1-SNAPSHOT. Can you test once and report back? |
Thank you for the changes, could you please release 4.2.1 to maven repository? This would make testing a lot more convenient. |
I'll make release once you confirm the fix solved the issue you are facing. I know testing with snapshot version require certain changes to your dependency management system, but I really want to avoid unverified fix release. |
4.2.1 has been released to maven central. |
We found that calling:
is very slow when the database is large (>200000 entries). We have indexed (multiple) properties in this collection, but not the one changed in the update (so no index on
somePropertyName
in the example above).Starting the debugger and pausing at a random time shows the following stack trace:
Our guess is that the update method does not take the modified properties into account (via the
.put
method in the example above) and updates all indices for properties available in the document that is retrieved by the filter. Our investigation lets us believe that there are two solutions:Either these properties should be taken into account starting from
org.dizitart.no2.collection.operation.WriteOperations.update(Filter, Document, UpdateOptions)
Line 129, where the modified properties are available anddocumentIndexWriter.updateIndexEntry(oldDocument, processed);
could be passed those properties, such that non-modified ones can be skipped.Or in
org.dizitart.no2.collection.operation.DocumentIndexWriter.updateIndexEntry(Document, Document)
only the properties differing between oldDocument and newDocument should be indexed anew, which would have more overhead than the suggestion above.This slow-down is currently a really big problem for us, as updating properties in documents is essential for our workflow.
The text was updated successfully, but these errors were encountered: