Drupal 查询获取结果
在drupal网站中,我们得到的sql查询数据导出非常慢(需要很长时间)的问题如何解决这个问题 查询如下Drupal 查询获取结果,drupal,Drupal,在drupal网站中,我们得到的sql查询数据导出非常慢(需要很长时间)的问题如何解决这个问题 查询如下 SELECT DISTINCT(a.*), c.nid, b.uac_inst_campus_cricos FROM uac_export_coursetable_latest AS a LEFT JOIN uac_institutiondata AS c ON c.uac_institutiondata_institution = a.uac_course_institutio
SELECT DISTINCT(a.*), c.nid, b.uac_inst_campus_cricos
FROM uac_export_coursetable_latest AS a
LEFT JOIN uac_institutiondata AS c
ON c.uac_institutiondata_institution = a.uac_course_institution
LEFT JOIN uac_inst_campus_latest AS b
ON b.nid = c.nid AND b.uac_inst_furtherinfobox_heading = a.campusname
WHERE a.uac_course_institution = '6628'
AND intyear12 = 'Yes'
ORDER BY uaccoursecode
由于我们不知道自定义表的确切模式,因此无法为您提供确切的解决方案,但通常当查询执行缓慢时,您需要验证用于
联接的列以及WHERE
子句中的列
- 确保您正在加入外键列
- 确保在条件中使用的列上设置了索引
在您的情况下,我会在以下列中添加索引:uac\u institutiondata\u institution
(uac\u institutiondata
表)、intyear12
(uac\u export\u coursetable\u latest
)、nid
(uac\u inst\u campus\u latest
表)
如果uac\u export\u coursetable\u latest
表中的uac\u coursetable\u institution
列不是主键,也可以在该列的索引上
有关MySql数据库索引的详细信息: