以下查询用于在商业智能仪表板中创建饼图。查询运行并返回正确的数据,但是速度非常慢(大约 36 秒)。谁能看到优化此查询的方法?
SELECT
Name,
Date,
Severity,
PMissing
FROM
(
SELECT
Name,
Date,
Severity,
PMissing,
DENSE_RANK() OVER (PARTITION BY Name ORDER BY ate DESC) AS Rnk
FROM PctbyP
WHERE (Name like '%front-%'
OR Name like '%back-%'
OR Name like '%ap-%'
OR Name like '%mps-%'
OR Name like '%mg-%')
)t
WHERE rnk=1
AND PMissing != '0'