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

Fix N+1 queries in /api/v1/bed/ #1338

Open
Tracked by #1333
sainak opened this issue Jun 2, 2023 · 2 comments
Open
Tracked by #1333

Fix N+1 queries in /api/v1/bed/ #1338

sainak opened this issue Jun 2, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@sainak
Copy link
Member

sainak commented Jun 2, 2023

Sentry Issue: CARE-KA

Transaction Name /api/v1/bed/
Parent Span django.view - bed-list
Repeating Spans (0) db - SELECT facility_facility.id, facility_facility.external_id, facility_facility.created_date, facility_facility.modified_date, facility_facility.deleted, facility_facility.name, facility_facility.is_active, facility_facility.verified, facility_facility.facility_type, facility_facility.kasp_empanelled, facility_facility.features, facility_facility.longitude, facility_facility.latitude, facility_facility.pincode, facility_facility.address, "facility...
db - SELECT (1) AS a FROM facility_consultationbed WHERE (facility_consultationbed.deleted = %s AND facility_consultationbed.bed_id = %s AND facility_consultationbed.end_date IS NULL) LIMIT 1
@sainak sainak mentioned this issue Jun 2, 2023
7 tasks
@sainak sainak added the good first issue Good for newcomers label Jun 6, 2023
@Yash12Bansal
Copy link

@sainak please assign this issue to me

dhruv-goyal-10 added a commit to dhruv-goyal-10/care that referenced this issue Feb 26, 2024
Removed is_occupied property from Bed model as it is not used anywhere

Annotated is_occupied field in the queryset instead of _is_occupied
vigneshhari pushed a commit that referenced this issue Mar 4, 2024
* Fixed N+1 queries issue in /api/v1/bed/

* Feat: PR review changes for issue #1338

Removed is_occupied property from Bed model as it is not used anywhere

Annotated is_occupied field in the queryset instead of _is_occupied

* Feat: PR review changes

Changed is_occupied from SerializerMethodField to Boolean Field

* Feat: PR Review Changes

Annotated is_occupied field irrespective of action

* Added the test case for listing beds API

* add comment explaining number of queries

---------

Co-authored-by: Aakash Singh <mail@singhaakash.dev>
Ashesh3 pushed a commit that referenced this issue Mar 5, 2024
* Fixed N+1 queries issue in /api/v1/bed/

* Feat: PR review changes for issue #1338

Removed is_occupied property from Bed model as it is not used anywhere

Annotated is_occupied field in the queryset instead of _is_occupied

* Feat: PR review changes

Changed is_occupied from SerializerMethodField to Boolean Field

* Feat: PR Review Changes

Annotated is_occupied field irrespective of action

* Added the test case for listing beds API

* add comment explaining number of queries

---------

Co-authored-by: Aakash Singh <mail@singhaakash.dev>
@jasonxiexy
Copy link

Hi @sainak,

I would like to contribute to the project by addressing the Fix N+1 queries issue (#1338) in the /api/v1/bed/ endpoint. Could I please be assigned to work on this task? I believe I can help optimize the queries and improve performance in this area.

Thank you,
Jason Xie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants