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 DB indexing to fields like Analyses status. #1140

Closed
sambles opened this issue Nov 19, 2024 · 2 comments · Fixed by #1144 or #1145
Closed

Add DB indexing to fields like Analyses status. #1140

sambles opened this issue Nov 19, 2024 · 2 comments · Fixed by #1144 or #1145
Assignees
Labels
Enhancement Small improvement or refinement. production
Milestone

Comments

@sambles
Copy link
Contributor

sambles commented Nov 19, 2024

Issue Description

Django supports putting db_index=True on model fields, this can speed up DB level fetch requests:

types-of-database-indexing-in-django
https://docs.djangoproject.com/en/5.1/ref/models/indexes/

@sambles sambles added the Enhancement Small improvement or refinement. label Nov 19, 2024
@sambles
Copy link
Contributor Author

sambles commented Nov 19, 2024

SubTask Status

status = models.CharField(max_length=max(len(c) for c in status_choices._db_values),
choices=status_choices, default=status_choices.NEW, editable=False)

analysis.status

status = models.CharField(
max_length=max(len(c) for c in status_choices._db_values),
choices=status_choices,
default=status_choices.PENDING,
editable=False,
)

@sambles
Copy link
Contributor Author

sambles commented Nov 19, 2024

Amir: For tables that have group_id in them, I think it also makes sense to have index on group_id, if group_id points to a group of users that belong to a separate security group/organisations. I think group_id index will help finding resources belonging to that group quicker.

Not 100% sure about this but if there is any field that a list query sorts the result based on that, I think indexing on that field might be beneficial. Also any parameter that list endpoints accept as filter parameters could be helpful. But I guess it’s too many index additions it’s better to do it in stages. Because indices consume additional storage in the DB so there might be a considerable storage impact if too many things are indexed.

@sambles sambles moved this from Todo to In Progress in Oasis Dev Team Tasks Nov 22, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Oasis Dev Team Tasks Nov 26, 2024
@awsbuild awsbuild added this to the 2.3.11 milestone Nov 28, 2024
@awsbuild awsbuild modified the milestones: 2.3.11, 2.4.0 Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Small improvement or refinement. production
Projects
Status: Done
2 participants