perm database query
Model method has perm looks for all the permission from Group and Permission. which is a heavy query.How can i optimized query time or any other solution to check user permission.
Example: SELECT "auth_permission"."id", "auth_permission"."name", "auth_permission"."content_type_id", "auth_permission"."codename" FROM "auth_permission" INNER JOIN "auth_group_permissions" ON ( "auth_permission"."id" = "auth_group_permissions"."permission_id" ) INNER JOIN "auth_group" ON ( "auth_group_permissions"."group_id" = "auth_group"."id" ) INNER JOIN "auth_user_groups" ON ( "auth_group"."id" = "auth_user_groups"."group_id" ) INNER JOIN "django_content_type" ON ( "auth_permission"."content_type_id" = "django_content_type"."id" ) WHERE "auth_user_groups"."user_id" = 1235 ORDER BY "django_content_type"."app_label" ASC, "django_content_type"."model" ASC, "auth_permission"."codename" ASC
SELECT "auth_permission"."id", "auth_permission"."name", "auth_permission"."content_type_id", "auth_permission"."codename", "django_content_type"."id", "django_content_type"."name", "django_content_type"."app_label", "django_content_type"."model" FROM "auth_permission" INNER JOIN "auth_user_user_permissions" ON ( "auth_permission"."id" = "auth_user_user_permissions"."permission_id" ) INNER JOIN "django_content_type" ON ( "auth_permission"."content_type_id" = "django_content_type"."id" ) WHERE "auth_user_user_permissions"."user_id" = 1235 ORDER BY "django_content_type"."app_label" ASC, "django_content_type"."model" ASC, "auth_permission"."codename" ASC
链接地址: http://www.djcxy.com/p/62454.html上一篇: 优化我的mysql查询
下一篇: perm数据库查询