🔁 Add index to model field in transaction schema #6890
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request makes an important change to the
transactionSchema
in thepackages/data-schemas
module to improve database indexing.packages/data-schemas/src/schema/transaction.ts
: Added an index to themodel
field in thetransactionSchema
to improve query performance.Because we are using mongo atlas, we've been noticing that lots of queries are being made to Transactions collection to get models.
In our QA environment we've noticed that the execution is actually very frequent - around twice a minute - scaning 80k document, taking around 450ms and returning only 1 Document
On this matter, Mongo Atlas is advising on creating this index.
To further "help" this situation we've also installed Ruben's prom-exporter that might be affecting this issue even further, however I believe that every gain of drop is good for LChat and thus making this PR :)
Change Type
Please delete any irrelevant options.
Checklist
Please delete any irrelevant options.
Please do let me know if anything else is needed