it-swarm-es.com

¿Por qué mis opiniones tardarían más en cargarse cuando haya iniciado sesión como un usuario habitual de la que he iniciado sesión como administrador

Tengo una visualización de vistas que devuelve una tabla de 30 filas de parámetros de nodo que toma aproximadamente 16 segundos para cargarse cuando no estoy conectado como usuario 1 o uno de los usuarios con la función de administrador. Cuando haya iniciado sesión como administrador, las vistas tardan aproximadamente 2 segundos en cargarse.

¿Qué estoy haciendo mal aquí?

actualización

Definitivamente, es el problema de User_Access ... la siguiente pregunta será, ¿cómo configuro las vistas para que solo verifique las restricciones colocadas en las vistas? Aquí están los SQL de lado a lado.

SELECT node.nid AS nid,
   node_data_field_lg_year.field_lg_year_value AS node_data_field_lg_year_field_lg_year_value,
   node.type AS node_type,
   node.vid AS node_vid,
   node_data_field_lg_year.field_lg_pl_value AS node_data_field_lg_year_field_lg_pl_value,
   node_data_field_lg_year.field_lg_act_value AS node_data_field_lg_year_field_lg_act_value,
   node_data_field_lg_year.field_lg_res_value AS node_data_field_lg_year_field_lg_res_value,
   node_data_field_lg_year.field_lg_sb_value AS node_data_field_lg_year_field_lg_sb_value,
   node_data_field_lg_year.field_lg_hb_value AS node_data_field_lg_year_field_lg_hb_value,
   node_data_field_lg_year.field_lg_session_value AS node_data_field_lg_year_field_lg_session_value,
   node.uid AS node_uid,
   node_revisions.format AS node_revisions_format,
   node.status AS node_status
 FROM {node} node 
 LEFT JOIN {content_type_paleghist} node_data_field_lg_year ON node.vid = node_data_field_lg_year.vid
 LEFT JOIN {node_revisions} node_revisions ON node.vid = node_revisions.vid
 WHERE node.type in ('%s')
   ORDER BY node_data_field_lg_year_field_lg_year_value ASC



SELECT DISTINCT node.nid AS nid,
   node_data_field_lg_year.field_lg_year_value AS node_data_field_lg_year_field_lg_year_value,
   node.type AS node_type,
   node.vid AS node_vid,
   node_data_field_lg_year.field_lg_pl_value AS node_data_field_lg_year_field_lg_pl_value,
   node_data_field_lg_year.field_lg_act_value AS node_data_field_lg_year_field_lg_act_value,
   node_data_field_lg_year.field_lg_res_value AS node_data_field_lg_year_field_lg_res_value,
   node_data_field_lg_year.field_lg_sb_value AS node_data_field_lg_year_field_lg_sb_value,
   node_data_field_lg_year.field_lg_hb_value AS node_data_field_lg_year_field_lg_hb_value,
   node_data_field_lg_year.field_lg_session_value AS node_data_field_lg_year_field_lg_session_value,
   node.uid AS node_uid,
   node_revisions.format AS node_revisions_format,
   node.status AS node_status
 FROM node node
 LEFT JOIN content_type_paleghist node_data_field_lg_year ON node.vid = node_data_field_lg_year.vid
 LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
  INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 2 AND na.realm = 'members_only blog') OR (na.gid = 2 AND na.realm = 'all_view blog') OR (na.gid = 2 AND na.realm = 'members_only image') OR (na.gid = 2 AND na.realm = 'all_view image') OR (na.gid = 2 AND na.realm = 'members_only product') OR (na.gid = 2 AND na.realm = 'all_view product') OR (na.gid = 2 AND na.realm = 'members_only memberships') OR (na.gid = 2 AND na.realm = 'all_view memberships') OR (na.gid = 2 AND na.realm = 'members_only donation') OR (na.gid = 2 AND na.realm = 'all_view donation') OR (na.gid = 2 AND na.realm = 'members_only book_sale') OR (na.gid = 2 AND na.realm = 'all_view book_sale') OR (na.gid = 2 AND na.realm = 'members_only cle_class') OR (na.gid = 2 AND na.realm = 'all_view cle_class') OR (na.gid = 2 AND na.realm = 'members_only cle_class_event') OR (na.gid = 2 AND na.realm = 'all_view cle_class_event') OR (na.gid = 2 AND na.realm = 'members_only cle_instructor') OR (na.gid = 2 AND na.realm = 'all_view cle_instructor') OR (na.gid = 2 AND na.realm = 'members_only cle_registrant') OR (na.gid = 3 AND na.realm = 'checkout_item cle_registrant') OR (na.gid = 36 AND na.realm = 'checkout_item cle_registrant') OR (na.gid = 2 AND na.realm = 'members_only cle_roster') OR (na.gid = 3 AND na.realm = 'no_access cle_roster') OR (na.gid = 2 AND na.realm = 'members_only cle_student') OR (na.gid = 3 AND na.realm = 'node_specific cle_student') OR (na.gid = 2 AND na.realm = 'members_only event') OR (na.gid = 2 AND na.realm = 'all_view event') OR (na.gid = 2 AND na.realm = 'members_only jenkdb') OR (na.gid = 2 AND na.realm = 'all_view jenkdb') OR (na.gid = 2 AND na.realm = 'members_only nn') OR (na.gid = 2 AND na.realm = 'all_view nn') OR (na.gid = 2 AND na.realm = 'members_only asklib') OR (na.gid = 3 AND na.realm = 'no_access asklib') OR (na.gid = 1 AND na.realm = 'members_only paleghist') OR (na.gid = 1 AND na.realm = 'all_view paleghist') OR (na.gid = 2 AND na.realm = 'members_only membership_benefits') OR (na.gid = 2 AND na.realm = 'all_view membership_benefits') OR (na.gid = 2 AND na.realm = 'members_only member_directory') OR (na.gid = 2 AND na.realm = 'all_view member_directory') OR (na.gid = 2 AND na.realm = 'members_only page') OR (na.gid = 2 AND na.realm = 'all_view page') OR (na.gid = 2 AND na.realm = 'members_only jlldonate') OR (na.gid = 3 AND na.realm = 'checkout_item jlldonate') OR (na.gid = 36 AND na.realm = 'checkout_item jlldonate') OR (na.gid = 2 AND na.realm = 'members_only rb_case') OR (na.gid = 2 AND na.realm = 'all_view rb_case') OR (na.gid = 2 AND na.realm = 'members_only docdel') OR (na.gid = 3 AND na.realm = 'checkout_item docdel') OR (na.gid = 36 AND na.realm = 'checkout_item docdel') OR (na.gid = 2 AND na.realm = 'members_only book_suggestions') OR (na.gid = 3 AND na.realm = 'no_access book_suggestions') OR (na.gid = 1 AND na.realm = 'members_only document_download') OR (na.gid = 1 AND na.realm = 'no_access document_download') OR (na.gid = 2 AND na.realm = 'members_only form_info_nodes') OR (na.gid = 1 AND na.realm = 'members_only jllfileshare') OR (na.gid = 1 AND na.realm = 'node_specific jllfileshare') OR (na.gid = 2 AND na.realm = 'members_only story') OR (na.gid = 2 AND na.realm = 'all_view story') OR (na.gid = 2 AND na.realm = 'members_only suggestions') OR (na.gid = 3 AND na.realm = 'no_access suggestions'))) AND (  node.type in ('paleghist')
   )ORDER BY node_data_field_lg_year_field_lg_year_value ASC
 LIMIT 0, 30;
2
DKinzer

Como puede ver, las vistas deben agregar unirse a la tabla NODE_Access para usuarios sin los nodos administradores (acceso de bypass nodo en D7) para verificar qué nodos se les permite ver.

16 segundos es extremadamente largo, ¿cuántos nodos hay? ¿Está utilizando módulos de acceso de contenido múltiple? Compruebe el número de filas en {node_Access}. Usted también deja que MySQL explique lo que está haciendo con la consulta ejecutando EXPLAIN query_here. Luego mostrará qué índices está usando y así sucesivamente.

4
Berdir

Consulte el código para user_access() , no ejecuta ninguna consulta para UID 1.

1
tim.plunkett