Project

General

Profile

Support #68317

SQL: requête non optimisée à la connexion

Added by Pierre Ducroquet 5 months ago. Updated 5 months ago.

Status:
Nouveau
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
22 August 2022
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

Requête identifiée sur toulouse:

SELECT * FROM "custom_user_user" WHERE (UPPER("custom_user_user"."email"::text) = UPPER('toto') OR "custom_user_user"."username" = 'toto') ORDER BY "custom_user_user"."is_active" DESC, "custom_user_user"."username" ASC, "custom_user_user"."id" ASC;

Il manque un index sur la colonne custom_user_user.username.
À toulouse, cela passe la requête de 130ms à 1ms.

History

#1

Updated by Pierre Ducroquet 5 months ago

Requête additionnelle:

SELECT "saml_libertysession".* FROM "saml_libertysession" WHERE ("saml_libertysession"."django_session_key" = 'abcdef' AND "saml_libertysession"."provider_id" = '42');

On passe de 30ms à moins de 1ms avec un index sur (provider_id, django_session_key).

Also available in: Atom PDF