我有一个查询将被放入一个过程中,它将创建一个 id 报告。我的查询的WHERE
子句(不是内部视图中的子句)是长时间运行的原因。这个查询需要大约twelve minutes
,我想知道你们是否有任何缩短运行时间的技巧。或者,即使balance = 0
在过程的 pl/sql 代码中,而不是在查询中,也可以不显示记录/行。
SELECT x.arp_person_id AS student_id,
xf_ar_charges(x.arp_person_id, '2008FL') as charges,
xf_ar_pymts(x.arp_person_id,'2008FL') as payment,
(xf_ar_charges(x.arp_person_id, '2008FL')
- (xf_ar_pymts(x.arp_person_id,'2008FL')) AS balance
FROM (select distinct arp_person_id
from ar_payments
WHERE arp_fa_transmittal IS NOT NULL
AND ('N' = 'N' OR arp_date BETWEEN TO_DATE('11/01/2008','MM/DD/YYYY')
AND TO_DATE('12/31/2008','MM/DD/YYYY'))
AND ('Y' = 'N' OR arp_term IN ('2008FL', 'N')) ) x
WHERE (xf_ar_charges(x.arp_person_id, '2008FL')
- (xf_ar_pymts(x.arp_person_id,'2008FL')) != 0;