-
Notifications
You must be signed in to change notification settings - Fork 103
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
Improve the index creation as per data model #2204
Comments
Thanks for your feedback! Could you test with a newer stack, please? Some of the versions you are using at at least 4 years old... In particular, considering the last versions at the time of writing this, it would be:
The index management behaviour has changed in newest versions, and although I cannot assure that it is working as expected with the current ones, it's better to check (and eventually debug and fix) with the last version of the software. |
I have tested with a newer version stack which is shared by you as below:
But the index creation as per data model is not applied in cygnus:2.20.0 also. |
The index are all created at same time, having all of them placed even if Are you facing any performance issue with this? Can you provide some tests comparing the performance between a table just with 2 indexes and a table with the 4 indexes? The code part related with the index creation is placed here |
Hi @fgalan , @mapedraza
We are having below performance issues in testing:
[Result of 'explain()']
Also in STH-Comet, indexes are created based on data model https://github.com/telefonicaid/fiware-sth-comet/blob/master/lib/database/sthDatabase.js#L159. The index creation logic at cygnus side should be in sync with sth-comet.
In case of 'collection per entity' datamodel, above key will not be used as data will not contain entityId. Same is with 'collection per attribute' datamodel. So, we should create an index which will work in case of ' collection per entity ' datamodel and 'collection per attribute ' datamodel. |
Fixed by PR #2205 |
Version:
・Orion : 2.1.0
・STH-Comet : 2.3.0
・Cygnus : 1.15.0
・MongoDB : 3.4
Bug Description:
An index is automatically created when creating an STH-Comet collection in MongoDB.
However, in STH-Comet's 'collection-per-entity' data model, when searching, STH-Comet does'nt use index and a full scan is performed.
So, after investigating we have found that cygnus in creating indexes . And for all data model same index is created so we need to improve index as per the data model.
Steps to reproduce:
After Integrating cygnus with orion, STH-Comet, MongoDBand executing below comands
[Collection confirmation]
[Index set on collection]
The following indexes are automatically created when creating a collection.
・entityId
・entityType
・attrName
・recvTime
[Collection data]
The 'entityId' and 'entityType' values for the index are not present in the registration data.
Expected behaviour:
Below command should not give entityId and entityType of index :
db['sth_x002ftestxfffftid1xfffftype'].getIndexes()
The text was updated successfully, but these errors were encountered: