ClockGU / ClockGU/clock-backend

Query time issue with "Tag" implementation

Open
#352 0 comments 0 reactions 1 assignee Claimed by @zakriya057 View on GitHub
enhancement feature proposal medium priority
Dominant language
Python
Stars
0
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Our current Implementation of tag's associated with a `Shift` is done via `django-taggit` [here](https://github.com/ClockGU/clock-backend/blob/79c5a8095cbf9abf44cc05432e84d5ae3ab1c93c/api/models.py#L196).
This implementation is somewhat lazy and causes a lot of overhead when querying all shifts
via the `/shifts` endpoint.
I have already created a branch in which `django-silky` is installed to profile the endpoints see the `profiling` branch.

Tags are a convenience feature for users to categorize `Shift` s and also sort them in a manner. Due to the nature
of how `django-taggit` implements Tags (ContentTypeRelations/Own db table) we are creating one query per shift object
as we are querying `Shift`s.

Main Issues:

1. Huge Query overhead
2. Somehow, if a new `Shift` has a `Tag` that is already existing, it is not reused but a new one is created (Not 100%, needs checking)

Goal:
Find a way to implement Tags in a way that the over head is reduced/eliminated. Possible changes in the Frontend are acceptable.

Check if `Tag`s are reused.
If `Tag`s are NOT reused, implement reusing them.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.