Skip to content
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

Add indexes #426

Merged
merged 2 commits into from
Mar 5, 2024
Merged

Add indexes #426

merged 2 commits into from
Mar 5, 2024

Conversation

loneil
Copy link
Contributor

@loneil loneil commented Feb 23, 2024

#425

Add indexes for the fields pres_exch_id and pyop_auth_code for the auth_session collection.

Those fields are used to look up on at various points in the VCAuthn flow so they should need indexing.
Can look for get_by_pyop_auth_code and get_by_pres_exch_id for usage in the code.

This just uses the pymongo create_index command in the init_db part of the app, which is called on startup of the oidc-controller.
This successfully added indexes on my local where there are around 500 documents already populated.
Note for consideration: do we need to think about index addition for running VCAuthn instances that may(?) have a lot of documents in the collection? Would that need millions? Billions? in order to be concern with an index addition? Not sure if we are close to that in any existing VCAuthn contexts using the auth_session collection.

Result right after adding and restarting controller:

image

Signed-off-by: Lucas ONeil <[email protected]>
@loneil loneil force-pushed the feature/addAuthSessionIndexes branch from c779bcf to 14cd182 Compare February 23, 2024 23:32
Copy link
Contributor

@Jsyro Jsyro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jamshale
Copy link
Contributor

jamshale commented Feb 26, 2024

Definitely seems like the correct indexes.

What is the auth_code? This is a unique identifier for the login? Or is this common number code? It won't help and might hurt if a lot of the entries are the same.

@loneil loneil self-assigned this Feb 27, 2024
@esune
Copy link
Member

esune commented Feb 27, 2024

Definitely seems like the correct indexes.

What is the auth_code? This is a unique identifier for the login? Or is this common number code? It won't help and might hurt if a lot of the entries are the same.

The auth_code is uniquer per authentication attempt, it won't be shared by sessions so it is safe to have an index on it if we are querying that collection based on its value.

@esune esune merged commit 30c54bd into main Mar 5, 2024
3 of 5 checks passed
@esune esune deleted the feature/addAuthSessionIndexes branch March 5, 2024 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants