If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Spurious database queries

RESOLVED INVALID

Status

Marketplace
General
RESOLVED INVALID
5 years ago
5 years ago

People

(Reporter: tarek, Unassigned)

Tracking

x86
Mac OS X
Points:
---

Details

(Reporter)

Description

5 years ago
When I am logged into Marketplace, doing a simple query on /search will generate over 20 calls on the same two queries:

22:02:53 django.db.backends:DEBUG (0.016) SELECT `auth_user`.`id`, `auth_user`.`username`, `auth_user`.`first_name`, `auth_user`.`last_name`, `auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`, `auth_user`.`is_active`, `auth_user`.`is_superuser`, `auth_user`.`last_login`, `auth_user`.`date_joined` FROM `auth_user` WHERE `auth_user`.`id` = 22 ; args=(22,) :/home/marketplace/.virtualenvs/marketplace/local/lib/python2.7/site-packages/django/db/backends/util.py:50

22:02:53 django.db.backends:DEBUG (0.000) SELECT `groups`.`id` FROM `groups` INNER JOIN `groups_users` ON (`groups`.`id` = `groups_users`.`group_id`) WHERE `groups_users`.`user_id` = 22 ; args=(22,) :/home/marketplace/.virtualenvs/marketplace/local/lib/python2.7/site-packages/django/db/backends/util.py:50

That's just to get the rights about the user and its groups.

No need to say, this information is not changing over the lifespan of that single request.

I think it could be interesting to dig into this to see if we could cache in memory at the request level the user/group information. That would potential avoid all those dupes.

What do you say ?
(Reporter)

Comment 1

5 years ago
looks like it's aleardy cached and these extra calls only happen on /media. Closing since I suppose those are served via a CND without looking for the user through the middleware
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.