on此RIGHT JOIN
查询导致TABLE ACCESS FULL
on lims.operator
。常规连接运行很快,但当然,样本 ' WHERE authorised_by IS NULL
' 不会出现。
在这种情况下,是否有更有效的替代方案RIGHT JOIN
?
SELECT full_name
FROM (SELECT operator_id AS authorised_by, full_name
FROM lims.operator)
RIGHT JOIN (SELECT sample_id, authorised_by
FROM lims.sample
WHERE sample_template_id = 200)
USING (authorised_by)
注意:显示的所有列(全名除外)都已编入索引,并且是某些表的主键。