Closed Bug 798257 Opened 12 years ago Closed 12 years ago

Spurious database queries

Categories

(Marketplace Graveyard :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: tarek, Unassigned)

Details

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 ?
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
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.